@sippulse/niva-sdk 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/chat.d.ts +2 -0
- package/chat.js +1083 -0
- package/chunk-3w2v383z.js +4350 -0
- package/chunk-50ad2r7x.js +76 -0
- package/dts/src/chat/client.d.ts +10 -0
- package/dts/src/chat/download.d.ts +19 -0
- package/dts/src/chat/emitter.d.ts +8 -0
- package/dts/src/chat/end.d.ts +9 -0
- package/dts/src/chat/error.d.ts +15 -0
- package/dts/src/chat/index.d.ts +5 -0
- package/dts/src/chat/input.d.ts +12 -0
- package/dts/src/chat/policy.d.ts +14 -0
- package/dts/src/chat/queue.d.ts +24 -0
- package/dts/src/chat/socket.d.ts +12 -0
- package/dts/src/chat/storage.d.ts +18 -0
- package/dts/src/chat/timers.d.ts +12 -0
- package/dts/src/chat/transfer.d.ts +21 -0
- package/dts/src/chat/types.d.ts +236 -0
- package/dts/src/chat/upload.d.ts +48 -0
- package/dts/src/chat/wire.d.ts +46 -0
- package/dts/src/client.d.ts +8 -0
- package/dts/src/entry/chat.d.ts +2 -0
- package/dts/src/generated/client.d.ts +591 -50
- package/dts/src/generated/meta.d.ts +1 -1
- package/dts/src/generated/operations.d.ts +13367 -4813
- package/dts/src/generated/webhooks.d.ts +208 -1
- package/index.bun.js +48 -3419
- package/index.default.js +45 -3383
- package/index.deno.js +48 -3419
- package/index.node.js +47 -3418
- package/package.json +9 -1
package/index.default.js
CHANGED
|
@@ -1,3392 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
reason;
|
|
26
|
-
constructor(message, options) {
|
|
27
|
-
super(message, options);
|
|
28
|
-
this.reason = options.reason;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
class NivaConfigurationError extends NivaError {
|
|
33
|
-
name = "NivaConfigurationError";
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
class NivaIncompatibleServerError extends NivaError {
|
|
37
|
-
name = "NivaIncompatibleServerError";
|
|
38
|
-
serverVersion;
|
|
39
|
-
supported;
|
|
40
|
-
installCommand;
|
|
41
|
-
constructor(message, details) {
|
|
42
|
-
super(message);
|
|
43
|
-
this.serverVersion = details.serverVersion;
|
|
44
|
-
this.supported = details.supported;
|
|
45
|
-
this.installCommand = details.installCommand;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
class NivaUnavailableError extends NivaError {
|
|
50
|
-
name = "NivaUnavailableError";
|
|
51
|
-
operation;
|
|
52
|
-
reason;
|
|
53
|
-
module;
|
|
54
|
-
constructor(operation, options) {
|
|
55
|
-
super(options.reason === "operation" ? `Operation ${operation} is not served by this NIVA installation` : `Operation ${operation} needs module ${options.module ?? "unknown"}, which is disabled on this installation`);
|
|
56
|
-
this.operation = operation;
|
|
57
|
-
this.reason = options.reason;
|
|
58
|
-
this.module = options.module;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
class NivaWebhookError extends NivaError {
|
|
63
|
-
name = "NivaWebhookError";
|
|
64
|
-
kind;
|
|
65
|
-
code;
|
|
66
|
-
constructor(kind, code, message) {
|
|
67
|
-
super(message);
|
|
68
|
-
this.kind = kind;
|
|
69
|
-
this.code = code;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
function isNivaApiError(err, code) {
|
|
73
|
-
return err instanceof NivaApiError && (code === undefined || err.code === code);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// src/sse.ts
|
|
77
|
-
function parseFrame(block) {
|
|
78
|
-
let event;
|
|
79
|
-
const dataLines = [];
|
|
80
|
-
for (const line of block.split(`
|
|
81
|
-
`)) {
|
|
82
|
-
if (line === "")
|
|
83
|
-
continue;
|
|
84
|
-
if (line.startsWith(":"))
|
|
85
|
-
continue;
|
|
86
|
-
const colon = line.indexOf(":");
|
|
87
|
-
if (colon === -1)
|
|
88
|
-
continue;
|
|
89
|
-
const field = line.slice(0, colon);
|
|
90
|
-
const value = line.slice(colon + 1).startsWith(" ") ? line.slice(colon + 2) : line.slice(colon + 1);
|
|
91
|
-
if (field === "event")
|
|
92
|
-
event = value;
|
|
93
|
-
else if (field === "data")
|
|
94
|
-
dataLines.push(value);
|
|
95
|
-
}
|
|
96
|
-
if (event === undefined)
|
|
97
|
-
return;
|
|
98
|
-
return { event, dataLines };
|
|
99
|
-
}
|
|
100
|
-
function frameData(frame) {
|
|
101
|
-
const text = frame.dataLines.join(`
|
|
102
|
-
`);
|
|
103
|
-
if (text === "")
|
|
104
|
-
return;
|
|
105
|
-
const parsed = JSON.parse(text);
|
|
106
|
-
return parsed;
|
|
107
|
-
}
|
|
108
|
-
function isRecord(value) {
|
|
109
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
110
|
-
}
|
|
111
|
-
function errorFromFrame(frame, data, operation) {
|
|
112
|
-
if (isRecord(data) && data["defined"] === true && typeof data["code"] === "string") {
|
|
113
|
-
return new NivaApiError({
|
|
114
|
-
status: typeof data["status"] === "number" ? data["status"] : 500,
|
|
115
|
-
code: data["code"],
|
|
116
|
-
message: typeof data["message"] === "string" ? data["message"] : "stream error",
|
|
117
|
-
data: data["data"],
|
|
118
|
-
operation
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
return new NivaApiError({
|
|
122
|
-
status: 500,
|
|
123
|
-
code: "UNEXPECTED_RESPONSE",
|
|
124
|
-
message: `unexpected stream event ${frame.event}`,
|
|
125
|
-
operation
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
function messageValue(frame) {
|
|
129
|
-
return frameData(frame);
|
|
130
|
-
}
|
|
131
|
-
async function* emptyGenerator() {}
|
|
132
|
-
async function* readFrames(reader, decoder, isClosed) {
|
|
133
|
-
let buffer = "";
|
|
134
|
-
const carry = { current: "" };
|
|
135
|
-
for (;; ) {
|
|
136
|
-
if (isClosed())
|
|
137
|
-
return;
|
|
138
|
-
const chunk = await reader.read();
|
|
139
|
-
buffer += normalizeChunk(decoder, chunk.done ? undefined : chunk.value, carry);
|
|
140
|
-
const holder = { text: buffer };
|
|
141
|
-
for (const frame of takeFrames(holder)) {
|
|
142
|
-
yield frame;
|
|
143
|
-
if (isClosed())
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
buffer = holder.text;
|
|
147
|
-
if (chunk.done)
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
function normalizeChunk(decoder, raw, carry) {
|
|
152
|
-
if (raw === undefined) {
|
|
153
|
-
const flushed = carry.current === "\r" ? `
|
|
154
|
-
` : carry.current;
|
|
155
|
-
carry.current = "";
|
|
156
|
-
return flushed;
|
|
157
|
-
}
|
|
158
|
-
let text = carry.current + decoder.decode(raw, { stream: true });
|
|
159
|
-
carry.current = "";
|
|
160
|
-
if (text.endsWith("\r")) {
|
|
161
|
-
carry.current = "\r";
|
|
162
|
-
text = text.slice(0, -1);
|
|
163
|
-
}
|
|
164
|
-
return text.replaceAll(`\r
|
|
165
|
-
`, `
|
|
166
|
-
`).replaceAll("\r", `
|
|
167
|
-
`);
|
|
168
|
-
}
|
|
169
|
-
function takeFrames(buffer) {
|
|
170
|
-
const frames = [];
|
|
171
|
-
let boundary = buffer.text.indexOf(`
|
|
172
|
-
|
|
173
|
-
`);
|
|
174
|
-
while (boundary !== -1) {
|
|
175
|
-
const block = buffer.text.slice(0, boundary);
|
|
176
|
-
buffer.text = buffer.text.slice(boundary + 2);
|
|
177
|
-
const frame = parseFrame(block);
|
|
178
|
-
if (frame !== undefined)
|
|
179
|
-
frames.push(frame);
|
|
180
|
-
boundary = buffer.text.indexOf(`
|
|
181
|
-
|
|
182
|
-
`);
|
|
183
|
-
}
|
|
184
|
-
return frames;
|
|
185
|
-
}
|
|
186
|
-
function createSseStream(response, options) {
|
|
187
|
-
const operation = options?.operation ?? "unknown";
|
|
188
|
-
const callerSignal = options?.signal;
|
|
189
|
-
const reader = response.body?.getReader();
|
|
190
|
-
const decoder = new TextDecoder;
|
|
191
|
-
let closed = false;
|
|
192
|
-
async function cancelBody() {
|
|
193
|
-
closed = true;
|
|
194
|
-
try {
|
|
195
|
-
await reader?.cancel();
|
|
196
|
-
} catch {}
|
|
197
|
-
}
|
|
198
|
-
if (callerSignal !== undefined) {
|
|
199
|
-
if (callerSignal.aborted)
|
|
200
|
-
cancelBody();
|
|
201
|
-
else
|
|
202
|
-
callerSignal.addEventListener("abort", () => void cancelBody(), { once: true });
|
|
203
|
-
}
|
|
204
|
-
async function* iterate() {
|
|
205
|
-
if (reader === undefined)
|
|
206
|
-
return;
|
|
207
|
-
try {
|
|
208
|
-
for await (const frame of readFrames(reader, decoder, () => closed)) {
|
|
209
|
-
if (frame.event === "message") {
|
|
210
|
-
yield messageValue(frame);
|
|
211
|
-
} else if (frame.event === "done") {
|
|
212
|
-
await cancelBody();
|
|
213
|
-
return;
|
|
214
|
-
} else if (frame.event === "error") {
|
|
215
|
-
throw errorFromFrame(frame, frameData(frame), operation);
|
|
216
|
-
} else {
|
|
217
|
-
throw new NivaApiError({
|
|
218
|
-
status: 500,
|
|
219
|
-
code: "UNEXPECTED_RESPONSE",
|
|
220
|
-
message: `unexpected stream event ${frame.event}`,
|
|
221
|
-
operation
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
} finally {
|
|
226
|
-
if (!closed)
|
|
227
|
-
await cancelBody();
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
const iterator = iterate();
|
|
231
|
-
return {
|
|
232
|
-
[Symbol.asyncIterator]() {
|
|
233
|
-
return iterator;
|
|
234
|
-
},
|
|
235
|
-
close: async () => {
|
|
236
|
-
await cancelBody();
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
async function cancelQuietly(response) {
|
|
241
|
-
try {
|
|
242
|
-
await response.body?.cancel();
|
|
243
|
-
} catch {}
|
|
244
|
-
}
|
|
245
|
-
function streamFromResponse(responsePromise, options) {
|
|
246
|
-
let inner;
|
|
247
|
-
let closed = false;
|
|
248
|
-
let arrived;
|
|
249
|
-
responsePromise.then((response) => {
|
|
250
|
-
arrived = response;
|
|
251
|
-
if (closed)
|
|
252
|
-
cancelQuietly(response);
|
|
253
|
-
}, () => {
|
|
254
|
-
return;
|
|
255
|
-
});
|
|
256
|
-
const empty = {
|
|
257
|
-
[Symbol.asyncIterator]() {
|
|
258
|
-
return emptyGenerator();
|
|
259
|
-
},
|
|
260
|
-
close: async () => {}
|
|
261
|
-
};
|
|
262
|
-
async function* iterate() {
|
|
263
|
-
const response = await responsePromise;
|
|
264
|
-
if (closed) {
|
|
265
|
-
await cancelQuietly(response);
|
|
266
|
-
yield* empty;
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
inner = createSseStream(response, options);
|
|
270
|
-
yield* inner;
|
|
271
|
-
}
|
|
272
|
-
return {
|
|
273
|
-
[Symbol.asyncIterator]() {
|
|
274
|
-
return iterate();
|
|
275
|
-
},
|
|
276
|
-
close: async () => {
|
|
277
|
-
closed = true;
|
|
278
|
-
try {
|
|
279
|
-
await arrived?.body?.cancel();
|
|
280
|
-
} catch {}
|
|
281
|
-
await inner?.close();
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// src/generated/client-impl.ts
|
|
287
|
-
function buildNivaClient(call) {
|
|
288
|
-
return {
|
|
289
|
-
ai: {
|
|
290
|
-
getBudget: (options) => call("ai.getBudget", undefined, options),
|
|
291
|
-
getBudgetOverview: (options) => call("ai.getBudgetOverview", undefined, options),
|
|
292
|
-
getCallAnalyses: (input, options) => call("ai.getCallAnalyses", input, options),
|
|
293
|
-
getTranscription: (input, options) => call("ai.getTranscription", input, options),
|
|
294
|
-
getUsage: (options) => call("ai.getUsage", undefined, options),
|
|
295
|
-
listAgents: (options) => call("ai.listAgents", undefined, options),
|
|
296
|
-
listStructuredAnalyses: (input, options) => call("ai.listStructuredAnalyses", input, options),
|
|
297
|
-
runAnalysis: (input, options) => call("ai.runAnalysis", input, options),
|
|
298
|
-
runConfiguredAnalyses: (input, options) => call("ai.runConfiguredAnalyses", input, options),
|
|
299
|
-
runSpeechAnalytics: (input, options) => call("ai.runSpeechAnalytics", input, options),
|
|
300
|
-
searchTranscriptions: (input, options) => call("ai.searchTranscriptions", input, options),
|
|
301
|
-
transcribeNow: (input, options) => call("ai.transcribeNow", input, options)
|
|
302
|
-
},
|
|
303
|
-
apiKeys: {
|
|
304
|
-
create: (input, options) => call("apiKeys.create", input, options),
|
|
305
|
-
finishRotation: (input, options) => call("apiKeys.finishRotation", input, options),
|
|
306
|
-
get: (input, options) => call("apiKeys.get", input, options),
|
|
307
|
-
list: (input, options) => call("apiKeys.list", input, options),
|
|
308
|
-
revoke: (input, options) => call("apiKeys.revoke", input, options),
|
|
309
|
-
rotate: (input, options) => call("apiKeys.rotate", input, options),
|
|
310
|
-
update: (input, options) => call("apiKeys.update", input, options),
|
|
311
|
-
usage: (input, options) => call("apiKeys.usage", input, options)
|
|
312
|
-
},
|
|
313
|
-
archive: {
|
|
314
|
-
listDeleted: (input, options) => call("archive.listDeleted", input, options),
|
|
315
|
-
purge: (input, options) => call("archive.purge", input, options),
|
|
316
|
-
restore: (input, options) => call("archive.restore", input, options),
|
|
317
|
-
summary: (options) => call("archive.summary", undefined, options)
|
|
318
|
-
},
|
|
319
|
-
audioFiles: {
|
|
320
|
-
content: (input, options) => call("audioFiles.content", input, options),
|
|
321
|
-
delete: (input, options) => call("audioFiles.delete", input, options),
|
|
322
|
-
generateTts: (input, options) => call("audioFiles.generateTts", input, options),
|
|
323
|
-
getById: (input, options) => call("audioFiles.getById", input, options),
|
|
324
|
-
list: (input, options) => call("audioFiles.list", input, options),
|
|
325
|
-
previewUrl: (input, options) => call("audioFiles.previewUrl", input, options),
|
|
326
|
-
regenerateTts: (input, options) => call("audioFiles.regenerateTts", input, options),
|
|
327
|
-
update: (input, options) => call("audioFiles.update", input, options),
|
|
328
|
-
upload: (input, options) => call("audioFiles.upload", input, options)
|
|
329
|
-
},
|
|
330
|
-
audit: {
|
|
331
|
-
count: (input, options) => call("audit.count", input, options),
|
|
332
|
-
exportCsv: (input, options) => streamFromResponse(call("audit.exportCsv", input, options), {
|
|
333
|
-
signal: options?.signal,
|
|
334
|
-
operation: "audit.exportCsv"
|
|
335
|
-
}),
|
|
336
|
-
list: (input, options) => call("audit.list", input, options)
|
|
337
|
-
},
|
|
338
|
-
bugReports: {
|
|
339
|
-
create: (input, options) => call("bugReports.create", input, options)
|
|
340
|
-
},
|
|
341
|
-
callRecords: {
|
|
342
|
-
count: (input, options) => call("callRecords.count", input, options),
|
|
343
|
-
exportCsv: (input, options) => streamFromResponse(call("callRecords.exportCsv", input, options), {
|
|
344
|
-
signal: options?.signal,
|
|
345
|
-
operation: "callRecords.exportCsv"
|
|
346
|
-
}),
|
|
347
|
-
getById: (input, options) => call("callRecords.getById", input, options),
|
|
348
|
-
getEvents: (input, options) => call("callRecords.getEvents", input, options),
|
|
349
|
-
getRecordingUrl: (input, options) => call("callRecords.getRecordingUrl", input, options),
|
|
350
|
-
list: (input, options) => call("callRecords.list", input, options),
|
|
351
|
-
purgeVoiceContent: (input, options) => call("callRecords.purgeVoiceContent", input, options),
|
|
352
|
-
recordingContent: (input, options) => call("callRecords.recordingContent", input, options),
|
|
353
|
-
retryRecording: (input, options) => call("callRecords.retryRecording", input, options)
|
|
354
|
-
},
|
|
355
|
-
calls: {
|
|
356
|
-
hangupCall: (input, options) => call("calls.hangupCall", input, options),
|
|
357
|
-
originate: (input, options) => call("calls.originate", input, options)
|
|
358
|
-
},
|
|
359
|
-
capabilities: {
|
|
360
|
-
get: (options) => call("capabilities.get", undefined, options)
|
|
361
|
-
},
|
|
362
|
-
channels: {
|
|
363
|
-
create: (input, options) => call("channels.create", input, options),
|
|
364
|
-
delete: (input, options) => call("channels.delete", input, options),
|
|
365
|
-
getById: (input, options) => call("channels.getById", input, options),
|
|
366
|
-
list: (input, options) => call("channels.list", input, options),
|
|
367
|
-
testConnection: (input, options) => call("channels.testConnection", input, options),
|
|
368
|
-
toggle: (input, options) => call("channels.toggle", input, options),
|
|
369
|
-
update: (input, options) => call("channels.update", input, options)
|
|
370
|
-
},
|
|
371
|
-
contacts: {
|
|
372
|
-
getById: (input, options) => call("contacts.getById", input, options),
|
|
373
|
-
list: (input, options) => call("contacts.list", input, options),
|
|
374
|
-
update: (input, options) => call("contacts.update", input, options)
|
|
375
|
-
},
|
|
376
|
-
dashboard: {
|
|
377
|
-
capacityStatus: (options) => call("dashboard.capacityStatus", undefined, options),
|
|
378
|
-
watchDashboardMetrics: (options) => streamFromResponse(call("dashboard.watchDashboardMetrics", undefined, options), { signal: options?.signal, operation: "dashboard.watchDashboardMetrics" })
|
|
379
|
-
},
|
|
380
|
-
destinations: {
|
|
381
|
-
create: (input, options) => call("destinations.create", input, options),
|
|
382
|
-
delete: (input, options) => call("destinations.delete", input, options),
|
|
383
|
-
getById: (input, options) => call("destinations.getById", input, options),
|
|
384
|
-
list: (input, options) => call("destinations.list", input, options),
|
|
385
|
-
update: (input, options) => call("destinations.update", input, options)
|
|
386
|
-
},
|
|
387
|
-
dialerAttempts: {
|
|
388
|
-
list: (input, options) => call("dialerAttempts.list", input, options)
|
|
389
|
-
},
|
|
390
|
-
dialerCampaigns: {
|
|
391
|
-
control: (input, options) => call("dialerCampaigns.control", input, options),
|
|
392
|
-
create: (input, options) => call("dialerCampaigns.create", input, options),
|
|
393
|
-
delete: (input, options) => call("dialerCampaigns.delete", input, options),
|
|
394
|
-
get: (input, options) => call("dialerCampaigns.get", input, options),
|
|
395
|
-
list: (input, options) => call("dialerCampaigns.list", input, options),
|
|
396
|
-
liveStats: (input, options) => streamFromResponse(call("dialerCampaigns.liveStats", input, options), { signal: options?.signal, operation: "dialerCampaigns.liveStats" }),
|
|
397
|
-
orgLiveStats: (options) => streamFromResponse(call("dialerCampaigns.orgLiveStats", undefined, options), { signal: options?.signal, operation: "dialerCampaigns.orgLiveStats" }),
|
|
398
|
-
stats: (input, options) => call("dialerCampaigns.stats", input, options),
|
|
399
|
-
summary: (options) => call("dialerCampaigns.summary", undefined, options),
|
|
400
|
-
update: (input, options) => call("dialerCampaigns.update", input, options)
|
|
401
|
-
},
|
|
402
|
-
dialerContacts: {
|
|
403
|
-
add: (input, options) => call("dialerContacts.add", input, options),
|
|
404
|
-
bulkCancel: (input, options) => call("dialerContacts.bulkCancel", input, options),
|
|
405
|
-
bulkRequeue: (input, options) => call("dialerContacts.bulkRequeue", input, options),
|
|
406
|
-
cancel: (input, options) => call("dialerContacts.cancel", input, options),
|
|
407
|
-
exportCsv: (input, options) => streamFromResponse(call("dialerContacts.exportCsv", input, options), { signal: options?.signal, operation: "dialerContacts.exportCsv" }),
|
|
408
|
-
get: (input, options) => call("dialerContacts.get", input, options),
|
|
409
|
-
list: (input, options) => call("dialerContacts.list", input, options),
|
|
410
|
-
remove: (input, options) => call("dialerContacts.remove", input, options),
|
|
411
|
-
requeue: (input, options) => call("dialerContacts.requeue", input, options),
|
|
412
|
-
requeueAll: (input, options) => call("dialerContacts.requeueAll", input, options),
|
|
413
|
-
update: (input, options) => call("dialerContacts.update", input, options)
|
|
414
|
-
},
|
|
415
|
-
dialerDnc: {
|
|
416
|
-
add: (input, options) => call("dialerDnc.add", input, options),
|
|
417
|
-
bulkImport: (input, options) => call("dialerDnc.bulkImport", input, options),
|
|
418
|
-
bulkRemove: (input, options) => call("dialerDnc.bulkRemove", input, options),
|
|
419
|
-
list: (input, options) => call("dialerDnc.list", input, options),
|
|
420
|
-
remove: (input, options) => call("dialerDnc.remove", input, options)
|
|
421
|
-
},
|
|
422
|
-
dialerImports: {
|
|
423
|
-
create: (input, options) => call("dialerImports.create", input, options),
|
|
424
|
-
get: (input, options) => call("dialerImports.get", input, options),
|
|
425
|
-
invalidRows: (input, options) => call("dialerImports.invalidRows", input, options),
|
|
426
|
-
progress: (input, options) => streamFromResponse(call("dialerImports.progress", input, options), {
|
|
427
|
-
signal: options?.signal,
|
|
428
|
-
operation: "dialerImports.progress"
|
|
429
|
-
})
|
|
430
|
-
},
|
|
431
|
-
holidays: {
|
|
432
|
-
countries: (options) => call("holidays.countries", undefined, options),
|
|
433
|
-
create: (input, options) => call("holidays.create", input, options),
|
|
434
|
-
delete: (input, options) => call("holidays.delete", input, options),
|
|
435
|
-
import: (input, options) => call("holidays.import", input, options),
|
|
436
|
-
list: (input, options) => call("holidays.list", input, options),
|
|
437
|
-
previewImport: (input, options) => call("holidays.previewImport", input, options),
|
|
438
|
-
update: (input, options) => call("holidays.update", input, options),
|
|
439
|
-
groups: {
|
|
440
|
-
create: (input, options) => call("holidays.groups.create", input, options),
|
|
441
|
-
delete: (input, options) => call("holidays.groups.delete", input, options),
|
|
442
|
-
getById: (input, options) => call("holidays.groups.getById", input, options),
|
|
443
|
-
list: (input, options) => call("holidays.groups.list", input, options),
|
|
444
|
-
update: (input, options) => call("holidays.groups.update", input, options)
|
|
445
|
-
}
|
|
446
|
-
},
|
|
447
|
-
insights: {
|
|
448
|
-
aggregate: (input, options) => call("insights.aggregate", input, options)
|
|
449
|
-
},
|
|
450
|
-
license: {
|
|
451
|
-
modules: (options) => call("license.modules", undefined, options),
|
|
452
|
-
status: (options) => call("license.status", undefined, options)
|
|
453
|
-
},
|
|
454
|
-
nodes: {
|
|
455
|
-
list: (options) => call("nodes.list", undefined, options),
|
|
456
|
-
schema: (input, options) => call("nodes.schema", input, options)
|
|
457
|
-
},
|
|
458
|
-
oauthGrants: {
|
|
459
|
-
list: (input, options) => call("oauthGrants.list", input, options),
|
|
460
|
-
revoke: (input, options) => call("oauthGrants.revoke", input, options),
|
|
461
|
-
usage: (input, options) => call("oauthGrants.usage", input, options)
|
|
462
|
-
},
|
|
463
|
-
orgSettings: {
|
|
464
|
-
getDialer: (options) => call("orgSettings.getDialer", undefined, options),
|
|
465
|
-
upsertDialer: (input, options) => call("orgSettings.upsertDialer", input, options)
|
|
466
|
-
},
|
|
467
|
-
schedules: {
|
|
468
|
-
create: (input, options) => call("schedules.create", input, options),
|
|
469
|
-
delete: (input, options) => call("schedules.delete", input, options),
|
|
470
|
-
getById: (input, options) => call("schedules.getById", input, options),
|
|
471
|
-
list: (input, options) => call("schedules.list", input, options),
|
|
472
|
-
update: (input, options) => call("schedules.update", input, options)
|
|
473
|
-
},
|
|
474
|
-
secrets: {
|
|
475
|
-
list: (input, options) => call("secrets.list", input, options),
|
|
476
|
-
listNames: (options) => call("secrets.listNames", undefined, options)
|
|
477
|
-
},
|
|
478
|
-
signals: {
|
|
479
|
-
callSignals: (input, options) => call("signals.callSignals", input, options),
|
|
480
|
-
create: (input, options) => call("signals.create", input, options),
|
|
481
|
-
delete: (input, options) => call("signals.delete", input, options),
|
|
482
|
-
get: (input, options) => call("signals.get", input, options),
|
|
483
|
-
list: (input, options) => call("signals.list", input, options),
|
|
484
|
-
overview: (options) => call("signals.overview", undefined, options),
|
|
485
|
-
presets: (input, options) => call("signals.presets", input, options),
|
|
486
|
-
test: (input, options) => call("signals.test", input, options),
|
|
487
|
-
update: (input, options) => call("signals.update", input, options),
|
|
488
|
-
upsertBySlug: (input, options) => call("signals.upsertBySlug", input, options)
|
|
489
|
-
},
|
|
490
|
-
tts: {
|
|
491
|
-
listModels: (options) => call("tts.listModels", undefined, options),
|
|
492
|
-
listVoices: (input, options) => call("tts.listVoices", input, options),
|
|
493
|
-
preview: (input, options) => call("tts.preview", input, options)
|
|
494
|
-
},
|
|
495
|
-
users: {
|
|
496
|
-
activateMember: (input, options) => call("users.activateMember", input, options),
|
|
497
|
-
createMember: (input, options) => call("users.createMember", input, options),
|
|
498
|
-
listMembers: (input, options) => call("users.listMembers", input, options),
|
|
499
|
-
me: (options) => call("users.me", undefined, options),
|
|
500
|
-
removeMember: (input, options) => call("users.removeMember", input, options),
|
|
501
|
-
resetSecondFactor: (input, options) => call("users.resetSecondFactor", input, options),
|
|
502
|
-
revokeMemberSessions: (input, options) => call("users.revokeMemberSessions", input, options),
|
|
503
|
-
suspendMember: (input, options) => call("users.suspendMember", input, options),
|
|
504
|
-
unlockMember: (input, options) => call("users.unlockMember", input, options),
|
|
505
|
-
updateMyNotificationEmail: (input, options) => call("users.updateMyNotificationEmail", input, options),
|
|
506
|
-
updateMyNotificationToast: (input, options) => call("users.updateMyNotificationToast", input, options),
|
|
507
|
-
updateRole: (input, options) => call("users.updateRole", input, options)
|
|
508
|
-
},
|
|
509
|
-
visualPlans: {
|
|
510
|
-
clone: (input, options) => call("visualPlans.clone", input, options),
|
|
511
|
-
create: (input, options) => call("visualPlans.create", input, options),
|
|
512
|
-
delete: (input, options) => call("visualPlans.delete", input, options),
|
|
513
|
-
getById: (input, options) => call("visualPlans.getById", input, options),
|
|
514
|
-
importDraft: (input, options) => call("visualPlans.importDraft", input, options),
|
|
515
|
-
list: (input, options) => call("visualPlans.list", input, options),
|
|
516
|
-
listVersions: (input, options) => call("visualPlans.listVersions", input, options),
|
|
517
|
-
publish: (input, options) => call("visualPlans.publish", input, options),
|
|
518
|
-
update: (input, options) => call("visualPlans.update", input, options),
|
|
519
|
-
validate: (input, options) => call("visualPlans.validate", input, options)
|
|
520
|
-
},
|
|
521
|
-
webhooks: {
|
|
522
|
-
deliveries: {
|
|
523
|
-
count: (input, options) => call("webhooks.deliveries.count", input, options),
|
|
524
|
-
getById: (input, options) => call("webhooks.deliveries.getById", input, options),
|
|
525
|
-
list: (input, options) => call("webhooks.deliveries.list", input, options),
|
|
526
|
-
retention: (options) => call("webhooks.deliveries.retention", undefined, options),
|
|
527
|
-
retry: (input, options) => call("webhooks.deliveries.retry", input, options),
|
|
528
|
-
aggregates: {
|
|
529
|
-
get: (input, options) => call("webhooks.deliveries.aggregates.get", input, options),
|
|
530
|
-
list: (input, options) => call("webhooks.deliveries.aggregates.list", input, options)
|
|
531
|
-
}
|
|
532
|
-
},
|
|
533
|
-
endpoints: {
|
|
534
|
-
create: (input, options) => call("webhooks.endpoints.create", input, options),
|
|
535
|
-
delete: (input, options) => call("webhooks.endpoints.delete", input, options),
|
|
536
|
-
getById: (input, options) => call("webhooks.endpoints.getById", input, options),
|
|
537
|
-
list: (input, options) => call("webhooks.endpoints.list", input, options),
|
|
538
|
-
rotateSecret: (input, options) => call("webhooks.endpoints.rotateSecret", input, options),
|
|
539
|
-
test: (input, options) => call("webhooks.endpoints.test", input, options),
|
|
540
|
-
update: (input, options) => call("webhooks.endpoints.update", input, options)
|
|
541
|
-
},
|
|
542
|
-
events: {
|
|
543
|
-
list: (options) => call("webhooks.events.list", undefined, options)
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
};
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
// src/generated/meta.ts
|
|
550
|
-
var SDK_VERSION = "0.1.0";
|
|
551
|
-
var SUPPORTED_NIVA = { min: "2.0.0", max: null };
|
|
552
|
-
var PROTOCOL_VERSION = 1;
|
|
553
|
-
var COMPAT_TABLE = [
|
|
554
|
-
{ nivaMin: "2.0.0", nivaMax: null, distTag: "niva-2.0" }
|
|
555
|
-
];
|
|
556
|
-
|
|
557
|
-
// src/generated/operations.ts
|
|
558
|
-
var ERROR_CODES = [
|
|
559
|
-
"ACCOUNT_TARGET_FORBIDDEN",
|
|
560
|
-
"ACTIVE_CALL_NOT_FOUND",
|
|
561
|
-
"AI_INVALID_API_KEY",
|
|
562
|
-
"AI_NOT_CONFIGURED",
|
|
563
|
-
"AI_UNREACHABLE",
|
|
564
|
-
"ALREADY_MEMBER",
|
|
565
|
-
"API_KEY_EXPIRED",
|
|
566
|
-
"API_KEY_NOT_FOUND",
|
|
567
|
-
"ARCHIVE_ITEM_IN_USE",
|
|
568
|
-
"ARCHIVE_ITEM_NOT_FOUND",
|
|
569
|
-
"ARCHIVE_RESTORE_CONFLICT",
|
|
570
|
-
"AUDIO_FILE_CONTENT_MISSING",
|
|
571
|
-
"AUDIO_FILE_INVALID_FORMAT",
|
|
572
|
-
"AUDIO_FILE_IN_USE",
|
|
573
|
-
"AUDIO_FILE_NOT_FOUND",
|
|
574
|
-
"AUDIO_FILE_NOT_TTS",
|
|
575
|
-
"AUDIO_FILE_TOO_LARGE",
|
|
576
|
-
"AUDIO_URL_BLOCKED",
|
|
577
|
-
"AUDIO_URL_DECODE_FAILED",
|
|
578
|
-
"AUDIO_URL_HTTP_ERROR",
|
|
579
|
-
"AUDIO_URL_INVALID",
|
|
580
|
-
"AUDIO_URL_TIMEOUT",
|
|
581
|
-
"AUDIO_URL_TOO_LARGE",
|
|
582
|
-
"AUDIO_URL_UNREACHABLE",
|
|
583
|
-
"AUDIO_URL_UNSUPPORTED_FORMAT",
|
|
584
|
-
"AUDIT_CURSOR_INVALID",
|
|
585
|
-
"BUG_REPORTING_DISABLED",
|
|
586
|
-
"BUG_REPORT_DELIVERY_FAILED",
|
|
587
|
-
"CALL_HAS_NO_TRANSCRIPTION_WINDOW",
|
|
588
|
-
"CALL_NOT_FOUND",
|
|
589
|
-
"CALL_RECORD_CURSOR_INVALID",
|
|
590
|
-
"CANNOT_MANAGE_OWN_ACCOUNT",
|
|
591
|
-
"CANNOT_REMOVE_SELF",
|
|
592
|
-
"CANNOT_SUSPEND_SELF",
|
|
593
|
-
"CHANNEL_ALREADY_ASSIGNED",
|
|
594
|
-
"CHANNEL_CONNECTOR_NOT_ALLOWED",
|
|
595
|
-
"CHANNEL_CONNECTOR_REQUIRED",
|
|
596
|
-
"CHANNEL_CONNECTOR_UNAVAILABLE",
|
|
597
|
-
"CHANNEL_INVALID_CREDENTIALS",
|
|
598
|
-
"CHANNEL_NOT_FOUND",
|
|
599
|
-
"CHANNEL_WHATSAPP_NUMBER_NOT_IN_CONNECTOR",
|
|
600
|
-
"CONTACT_NOT_FOUND",
|
|
601
|
-
"DECISIONS_UNAVAILABLE",
|
|
602
|
-
"DESTINATION_NOT_FOUND",
|
|
603
|
-
"DIALER_CAMPAIGN_INVALID_TRANSITION",
|
|
604
|
-
"DIALER_CAMPAIGN_NOT_FOUND",
|
|
605
|
-
"DIALER_CAMPAIGN_NO_CONTACTS",
|
|
606
|
-
"DIALER_CAMPAIGN_PLAN_NOT_PUBLISHED",
|
|
607
|
-
"DIALER_CONTACT_DUPLICATE",
|
|
608
|
-
"DIALER_CONTACT_NOT_EDITABLE",
|
|
609
|
-
"DIALER_CONTACT_NOT_REQUEUEABLE",
|
|
610
|
-
"DIALER_DNC_DUPLICATE",
|
|
611
|
-
"DIALER_IMPORT_INVALID",
|
|
612
|
-
"DIALER_IMPORT_JOB_NOT_FOUND",
|
|
613
|
-
"DIALER_MODULE_DISABLED",
|
|
614
|
-
"DIALER_PLAN_IN_USE",
|
|
615
|
-
"DRAFT_STALE",
|
|
616
|
-
"DUPLICATE_CHANNEL",
|
|
617
|
-
"DUPLICATE_EMAIL",
|
|
618
|
-
"DUPLICATE_SIGNAL_SLUG",
|
|
619
|
-
"ESL_CONNECTION_ERROR",
|
|
620
|
-
"FEATURE_DISABLED",
|
|
621
|
-
"FORBIDDEN",
|
|
622
|
-
"HANGUP_FAILED",
|
|
623
|
-
"HOLIDAY_GROUP_NOT_FOUND",
|
|
624
|
-
"HOLIDAY_NOT_FOUND",
|
|
625
|
-
"INSIGHT_PERIOD_TOO_LONG",
|
|
626
|
-
"INSUFFICIENT_PERMISSIONS",
|
|
627
|
-
"INSUFFICIENT_SCOPE",
|
|
628
|
-
"INVALID_EXPORT_COLUMNS",
|
|
629
|
-
"LAST_ADMINISTRATOR",
|
|
630
|
-
"MEMBER_NOT_FOUND",
|
|
631
|
-
"MEMBER_SUSPENDED",
|
|
632
|
-
"MFA_SETUP_REQUIRED",
|
|
633
|
-
"MODULE_DISABLED",
|
|
634
|
-
"NAGER_API_ERROR",
|
|
635
|
-
"NEW_USER_REQUIRES_PASSWORD",
|
|
636
|
-
"NODE_NOT_IN_TRACE",
|
|
637
|
-
"NODE_RANGE_INVALID",
|
|
638
|
-
"OAUTH_GRANT_FORBIDDEN",
|
|
639
|
-
"OAUTH_GRANT_NOT_FOUND",
|
|
640
|
-
"ORIGINATE_CAPACITY_EXCEEDED",
|
|
641
|
-
"ORIGINATE_DESTINATION_NOT_ROUTABLE",
|
|
642
|
-
"ORIGINATE_FAILED",
|
|
643
|
-
"ORIGINATE_PLAN_NOT_PUBLISHED",
|
|
644
|
-
"PERMISSION_CEILING_EXCEEDED",
|
|
645
|
-
"PLAN_NOT_FOUND",
|
|
646
|
-
"PLAN_VALIDATION_FAILED",
|
|
647
|
-
"RANGE_HAS_NO_AUDIO",
|
|
648
|
-
"RANGE_NOT_APPLICABLE",
|
|
649
|
-
"RANGE_NOT_SATISFIABLE",
|
|
650
|
-
"RECORDING_CONTENT_MISSING",
|
|
651
|
-
"RECORDING_NOT_FOUND",
|
|
652
|
-
"ROLE_NOT_FOUND",
|
|
653
|
-
"ROLE_SCOPE_MISMATCH",
|
|
654
|
-
"SCHEDULE_NOT_FOUND",
|
|
655
|
-
"SELF_ROTATION_FORBIDDEN",
|
|
656
|
-
"SIGNAL_ALERT_OPTION_REMOVED",
|
|
657
|
-
"SIGNAL_ARCHIVED",
|
|
658
|
-
"SIGNAL_DEFINITION_INVALID",
|
|
659
|
-
"SIGNAL_KIND_IMMUTABLE",
|
|
660
|
-
"SIGNAL_NOT_FOUND",
|
|
661
|
-
"SIGNAL_TEST_NO_TRANSCRIPTION",
|
|
662
|
-
"SIGNAL_TEST_SOURCE_INVALID",
|
|
663
|
-
"SIGNAL_VERSION_CONFLICT",
|
|
664
|
-
"SSO_REQUIRED",
|
|
665
|
-
"TRANSCRIPTION_CAPACITY_EXCEEDED",
|
|
666
|
-
"TRANSCRIPTION_NOT_FOUND",
|
|
667
|
-
"TTS_VOICE_UNAVAILABLE",
|
|
668
|
-
"UNAUTHORIZED",
|
|
669
|
-
"WEBHOOK_DELIVERY_AGGREGATE_NOT_FOUND",
|
|
670
|
-
"WEBHOOK_DELIVERY_CURSOR_INVALID",
|
|
671
|
-
"WEBHOOK_DELIVERY_NOT_RETRYABLE",
|
|
672
|
-
"WEBHOOK_DELIVERY_RETENTION_EXPIRED",
|
|
673
|
-
"WEBHOOK_ENDPOINT_NOT_FOUND"
|
|
674
|
-
];
|
|
675
|
-
var COMMON_ERROR_CODES = [62, 72, 73, 109];
|
|
676
|
-
var ERROR_CODE_SETS = [
|
|
677
|
-
[],
|
|
678
|
-
[26, 27],
|
|
679
|
-
[67, 68],
|
|
680
|
-
[29, 67, 68],
|
|
681
|
-
[30, 67, 68],
|
|
682
|
-
[43, 67, 68],
|
|
683
|
-
[64, 67, 68],
|
|
684
|
-
[65, 67, 68],
|
|
685
|
-
[67, 68, 110],
|
|
686
|
-
[67, 68, 111],
|
|
687
|
-
[67, 68, 69],
|
|
688
|
-
[67, 68, 74],
|
|
689
|
-
[67, 68, 75],
|
|
690
|
-
[67, 68, 95],
|
|
691
|
-
[7, 67, 68],
|
|
692
|
-
[11, 14, 67, 68],
|
|
693
|
-
[12, 16, 67, 68],
|
|
694
|
-
[25, 67, 68, 74],
|
|
695
|
-
[41, 67, 68, 74],
|
|
696
|
-
[64, 67, 68, 75],
|
|
697
|
-
[66, 67, 68, 74],
|
|
698
|
-
[67, 68, 112, 113],
|
|
699
|
-
[67, 68, 71, 85],
|
|
700
|
-
[67, 68, 74, 114],
|
|
701
|
-
[67, 68, 79, 80],
|
|
702
|
-
[1, 60, 63, 67, 68],
|
|
703
|
-
[2, 3, 4, 67, 68],
|
|
704
|
-
[41, 50, 67, 68, 74],
|
|
705
|
-
[51, 52, 67, 68, 74],
|
|
706
|
-
[6, 7, 67, 68, 96],
|
|
707
|
-
[61, 67, 68, 74, 107],
|
|
708
|
-
[67, 68, 74, 86, 101],
|
|
709
|
-
[0, 31, 67, 68, 71, 85],
|
|
710
|
-
[2, 3, 4, 67, 68, 108],
|
|
711
|
-
[2, 3, 4, 67, 68, 74],
|
|
712
|
-
[29, 67, 68, 90, 91, 92],
|
|
713
|
-
[32, 67, 68, 70, 71, 85],
|
|
714
|
-
[33, 67, 68, 70, 71, 85],
|
|
715
|
-
[41, 45, 52, 67, 68, 74],
|
|
716
|
-
[45, 52, 53, 67, 68, 74],
|
|
717
|
-
[55, 67, 68, 74, 86, 101],
|
|
718
|
-
[8, 9, 10, 67, 68, 74],
|
|
719
|
-
[41, 48, 49, 52, 67, 68, 74],
|
|
720
|
-
[56, 67, 68, 74, 86, 87, 101],
|
|
721
|
-
[32, 67, 68, 70, 71, 85, 93, 94],
|
|
722
|
-
[44, 45, 46, 47, 54, 67, 68, 74],
|
|
723
|
-
[2, 3, 4, 13, 14, 15, 67, 68, 108],
|
|
724
|
-
[44, 45, 46, 47, 54, 67, 68, 74, 86],
|
|
725
|
-
[5, 58, 67, 68, 76, 85, 93, 94, 105],
|
|
726
|
-
[60, 61, 67, 68, 81, 82, 83, 84, 86],
|
|
727
|
-
[17, 18, 19, 20, 21, 22, 23, 24, 67, 68],
|
|
728
|
-
[3, 28, 67, 68, 74, 77, 78, 88, 89, 92, 106],
|
|
729
|
-
[34, 35, 36, 37, 38, 39, 40, 57, 67, 68, 74],
|
|
730
|
-
[29, 42, 59, 67, 68, 74, 86, 97, 98, 99, 100, 101, 102, 103, 104]
|
|
731
|
-
];
|
|
732
|
-
var OPERATIONS = {
|
|
733
|
-
"ai.getBudget": {
|
|
734
|
-
method: "GET",
|
|
735
|
-
path: "/ai/budget",
|
|
736
|
-
pathParams: [],
|
|
737
|
-
queryParams: [],
|
|
738
|
-
bodyKind: "none",
|
|
739
|
-
responseKind: "json",
|
|
740
|
-
codes: 11
|
|
741
|
-
},
|
|
742
|
-
"ai.getBudgetOverview": {
|
|
743
|
-
method: "GET",
|
|
744
|
-
path: "/ai/budget/overview",
|
|
745
|
-
pathParams: [],
|
|
746
|
-
queryParams: [],
|
|
747
|
-
bodyKind: "none",
|
|
748
|
-
responseKind: "json",
|
|
749
|
-
codes: 11
|
|
750
|
-
},
|
|
751
|
-
"ai.getCallAnalyses": {
|
|
752
|
-
method: "GET",
|
|
753
|
-
path: "/call-records/{call_record_id}/analyses",
|
|
754
|
-
pathParams: ["call_record_id"],
|
|
755
|
-
queryParams: [],
|
|
756
|
-
bodyKind: "none",
|
|
757
|
-
responseKind: "json",
|
|
758
|
-
codes: 2
|
|
759
|
-
},
|
|
760
|
-
"ai.getTranscription": {
|
|
761
|
-
method: "GET",
|
|
762
|
-
path: "/call-records/{call_record_id}/transcription",
|
|
763
|
-
pathParams: ["call_record_id"],
|
|
764
|
-
queryParams: [],
|
|
765
|
-
bodyKind: "none",
|
|
766
|
-
responseKind: "json",
|
|
767
|
-
codes: 2
|
|
768
|
-
},
|
|
769
|
-
"ai.getUsage": {
|
|
770
|
-
method: "GET",
|
|
771
|
-
path: "/ai/usage",
|
|
772
|
-
pathParams: [],
|
|
773
|
-
queryParams: [],
|
|
774
|
-
bodyKind: "none",
|
|
775
|
-
responseKind: "json",
|
|
776
|
-
codes: 11
|
|
777
|
-
},
|
|
778
|
-
"ai.listAgents": {
|
|
779
|
-
method: "GET",
|
|
780
|
-
path: "/ai/agents",
|
|
781
|
-
pathParams: [],
|
|
782
|
-
queryParams: [],
|
|
783
|
-
bodyKind: "none",
|
|
784
|
-
responseKind: "json",
|
|
785
|
-
codes: 34
|
|
786
|
-
},
|
|
787
|
-
"ai.listStructuredAnalyses": {
|
|
788
|
-
method: "GET",
|
|
789
|
-
path: "/ai/structured-analyses",
|
|
790
|
-
pathParams: [],
|
|
791
|
-
queryParams: ["refresh"],
|
|
792
|
-
bodyKind: "none",
|
|
793
|
-
responseKind: "json",
|
|
794
|
-
codes: 11
|
|
795
|
-
},
|
|
796
|
-
"ai.runAnalysis": {
|
|
797
|
-
method: "POST",
|
|
798
|
-
path: "/call-records/{call_record_id}/analyses",
|
|
799
|
-
pathParams: ["call_record_id"],
|
|
800
|
-
queryParams: [],
|
|
801
|
-
bodyKind: "json",
|
|
802
|
-
responseKind: "json",
|
|
803
|
-
codes: 30
|
|
804
|
-
},
|
|
805
|
-
"ai.runConfiguredAnalyses": {
|
|
806
|
-
method: "POST",
|
|
807
|
-
path: "/call-records/{call_record_id}/configured-analyses",
|
|
808
|
-
pathParams: ["call_record_id"],
|
|
809
|
-
queryParams: [],
|
|
810
|
-
bodyKind: "json",
|
|
811
|
-
responseKind: "json",
|
|
812
|
-
codes: 30
|
|
813
|
-
},
|
|
814
|
-
"ai.runSpeechAnalytics": {
|
|
815
|
-
method: "POST",
|
|
816
|
-
path: "/call-records/{call_record_id}/speech-analytics",
|
|
817
|
-
pathParams: ["call_record_id"],
|
|
818
|
-
queryParams: [],
|
|
819
|
-
bodyKind: "json",
|
|
820
|
-
responseKind: "json",
|
|
821
|
-
codes: 11
|
|
822
|
-
},
|
|
823
|
-
"ai.searchTranscriptions": {
|
|
824
|
-
method: "GET",
|
|
825
|
-
path: "/transcriptions/search",
|
|
826
|
-
pathParams: [],
|
|
827
|
-
queryParams: ["query", "limit", "threshold", "date_from", "date_to", "visual_plan_id"],
|
|
828
|
-
bodyKind: "none",
|
|
829
|
-
responseKind: "json",
|
|
830
|
-
codes: 11
|
|
831
|
-
},
|
|
832
|
-
"ai.transcribeNow": {
|
|
833
|
-
method: "POST",
|
|
834
|
-
path: "/call-records/{call_record_id}/transcription",
|
|
835
|
-
pathParams: ["call_record_id"],
|
|
836
|
-
queryParams: [],
|
|
837
|
-
bodyKind: "json",
|
|
838
|
-
responseKind: "json",
|
|
839
|
-
codes: 51
|
|
840
|
-
},
|
|
841
|
-
"apiKeys.create": {
|
|
842
|
-
method: "POST",
|
|
843
|
-
path: "/api-keys",
|
|
844
|
-
pathParams: [],
|
|
845
|
-
queryParams: [],
|
|
846
|
-
bodyKind: "json",
|
|
847
|
-
responseKind: "json",
|
|
848
|
-
codes: 2
|
|
849
|
-
},
|
|
850
|
-
"apiKeys.finishRotation": {
|
|
851
|
-
method: "POST",
|
|
852
|
-
path: "/api-keys/{api_key_id}/finish-rotation",
|
|
853
|
-
pathParams: ["api_key_id"],
|
|
854
|
-
queryParams: [],
|
|
855
|
-
bodyKind: "none",
|
|
856
|
-
responseKind: "json",
|
|
857
|
-
codes: 14
|
|
858
|
-
},
|
|
859
|
-
"apiKeys.get": {
|
|
860
|
-
method: "GET",
|
|
861
|
-
path: "/api-keys/{api_key_id}",
|
|
862
|
-
pathParams: ["api_key_id"],
|
|
863
|
-
queryParams: [],
|
|
864
|
-
bodyKind: "none",
|
|
865
|
-
responseKind: "json",
|
|
866
|
-
codes: 14
|
|
867
|
-
},
|
|
868
|
-
"apiKeys.list": {
|
|
869
|
-
method: "GET",
|
|
870
|
-
path: "/api-keys",
|
|
871
|
-
pathParams: [],
|
|
872
|
-
queryParams: ["search", "page", "limit", "sort_by", "sort_order"],
|
|
873
|
-
bodyKind: "none",
|
|
874
|
-
responseKind: "json",
|
|
875
|
-
codes: 2
|
|
876
|
-
},
|
|
877
|
-
"apiKeys.revoke": {
|
|
878
|
-
method: "DELETE",
|
|
879
|
-
path: "/api-keys/{api_key_id}",
|
|
880
|
-
pathParams: ["api_key_id"],
|
|
881
|
-
queryParams: [],
|
|
882
|
-
bodyKind: "none",
|
|
883
|
-
responseKind: "json",
|
|
884
|
-
codes: 14
|
|
885
|
-
},
|
|
886
|
-
"apiKeys.rotate": {
|
|
887
|
-
method: "POST",
|
|
888
|
-
path: "/api-keys/{api_key_id}/rotate",
|
|
889
|
-
pathParams: ["api_key_id"],
|
|
890
|
-
queryParams: [],
|
|
891
|
-
bodyKind: "json",
|
|
892
|
-
responseKind: "json",
|
|
893
|
-
codes: 29
|
|
894
|
-
},
|
|
895
|
-
"apiKeys.update": {
|
|
896
|
-
method: "PATCH",
|
|
897
|
-
path: "/api-keys/{api_key_id}",
|
|
898
|
-
pathParams: ["api_key_id"],
|
|
899
|
-
queryParams: [],
|
|
900
|
-
bodyKind: "json",
|
|
901
|
-
responseKind: "json",
|
|
902
|
-
codes: 14
|
|
903
|
-
},
|
|
904
|
-
"apiKeys.usage": {
|
|
905
|
-
method: "GET",
|
|
906
|
-
path: "/api-keys/{api_key_id}/usage",
|
|
907
|
-
pathParams: ["api_key_id"],
|
|
908
|
-
queryParams: ["days"],
|
|
909
|
-
bodyKind: "none",
|
|
910
|
-
responseKind: "json",
|
|
911
|
-
codes: 14
|
|
912
|
-
},
|
|
913
|
-
"archive.listDeleted": {
|
|
914
|
-
method: "GET",
|
|
915
|
-
path: "/archive",
|
|
916
|
-
pathParams: [],
|
|
917
|
-
queryParams: ["search", "page", "limit", "sort_by", "sort_order", "entity_type"],
|
|
918
|
-
bodyKind: "none",
|
|
919
|
-
responseKind: "json",
|
|
920
|
-
codes: 41
|
|
921
|
-
},
|
|
922
|
-
"archive.purge": {
|
|
923
|
-
method: "DELETE",
|
|
924
|
-
path: "/archive/{entity_type}/{id}",
|
|
925
|
-
pathParams: ["entity_type", "id"],
|
|
926
|
-
queryParams: [],
|
|
927
|
-
bodyKind: "none",
|
|
928
|
-
responseKind: "json",
|
|
929
|
-
codes: 41
|
|
930
|
-
},
|
|
931
|
-
"archive.restore": {
|
|
932
|
-
method: "POST",
|
|
933
|
-
path: "/archive/{entity_type}/{id}/restore",
|
|
934
|
-
pathParams: ["entity_type", "id"],
|
|
935
|
-
queryParams: [],
|
|
936
|
-
bodyKind: "none",
|
|
937
|
-
responseKind: "json",
|
|
938
|
-
codes: 41
|
|
939
|
-
},
|
|
940
|
-
"archive.summary": {
|
|
941
|
-
method: "GET",
|
|
942
|
-
path: "/archive/summary",
|
|
943
|
-
pathParams: [],
|
|
944
|
-
queryParams: [],
|
|
945
|
-
bodyKind: "none",
|
|
946
|
-
responseKind: "json",
|
|
947
|
-
codes: 41
|
|
948
|
-
},
|
|
949
|
-
"audioFiles.content": {
|
|
950
|
-
method: "GET",
|
|
951
|
-
path: "/audio-files/{audio_file_id}/content",
|
|
952
|
-
pathParams: ["audio_file_id"],
|
|
953
|
-
queryParams: [],
|
|
954
|
-
bodyKind: "none",
|
|
955
|
-
responseKind: "binary",
|
|
956
|
-
codes: 15
|
|
957
|
-
},
|
|
958
|
-
"audioFiles.delete": {
|
|
959
|
-
method: "DELETE",
|
|
960
|
-
path: "/audio-files/{audio_file_id}",
|
|
961
|
-
pathParams: ["audio_file_id"],
|
|
962
|
-
queryParams: [],
|
|
963
|
-
bodyKind: "none",
|
|
964
|
-
responseKind: "json",
|
|
965
|
-
codes: 46
|
|
966
|
-
},
|
|
967
|
-
"audioFiles.generateTts": {
|
|
968
|
-
method: "POST",
|
|
969
|
-
path: "/audio-files/generate-tts",
|
|
970
|
-
pathParams: [],
|
|
971
|
-
queryParams: [],
|
|
972
|
-
bodyKind: "json",
|
|
973
|
-
responseKind: "json",
|
|
974
|
-
codes: 46
|
|
975
|
-
},
|
|
976
|
-
"audioFiles.getById": {
|
|
977
|
-
method: "GET",
|
|
978
|
-
path: "/audio-files/{audio_file_id}",
|
|
979
|
-
pathParams: ["audio_file_id"],
|
|
980
|
-
queryParams: [],
|
|
981
|
-
bodyKind: "none",
|
|
982
|
-
responseKind: "json",
|
|
983
|
-
codes: 46
|
|
984
|
-
},
|
|
985
|
-
"audioFiles.list": {
|
|
986
|
-
method: "GET",
|
|
987
|
-
path: "/audio-files",
|
|
988
|
-
pathParams: [],
|
|
989
|
-
queryParams: ["search", "page", "limit", "sort_by", "sort_order"],
|
|
990
|
-
bodyKind: "none",
|
|
991
|
-
responseKind: "json",
|
|
992
|
-
codes: 2
|
|
993
|
-
},
|
|
994
|
-
"audioFiles.previewUrl": {
|
|
995
|
-
method: "POST",
|
|
996
|
-
path: "/audio-files/preview-url",
|
|
997
|
-
pathParams: [],
|
|
998
|
-
queryParams: [],
|
|
999
|
-
bodyKind: "json",
|
|
1000
|
-
responseKind: "binary",
|
|
1001
|
-
codes: 50
|
|
1002
|
-
},
|
|
1003
|
-
"audioFiles.regenerateTts": {
|
|
1004
|
-
method: "POST",
|
|
1005
|
-
path: "/audio-files/{audio_file_id}/regenerate-tts",
|
|
1006
|
-
pathParams: ["audio_file_id"],
|
|
1007
|
-
queryParams: [],
|
|
1008
|
-
bodyKind: "json",
|
|
1009
|
-
responseKind: "json",
|
|
1010
|
-
codes: 46
|
|
1011
|
-
},
|
|
1012
|
-
"audioFiles.update": {
|
|
1013
|
-
method: "PATCH",
|
|
1014
|
-
path: "/audio-files/{audio_file_id}",
|
|
1015
|
-
pathParams: ["audio_file_id"],
|
|
1016
|
-
queryParams: [],
|
|
1017
|
-
bodyKind: "json",
|
|
1018
|
-
responseKind: "json",
|
|
1019
|
-
codes: 46
|
|
1020
|
-
},
|
|
1021
|
-
"audioFiles.upload": {
|
|
1022
|
-
method: "POST",
|
|
1023
|
-
path: "/audio-files/upload",
|
|
1024
|
-
pathParams: [],
|
|
1025
|
-
queryParams: [],
|
|
1026
|
-
bodyKind: "multipart",
|
|
1027
|
-
responseKind: "json",
|
|
1028
|
-
codes: 16
|
|
1029
|
-
},
|
|
1030
|
-
"audit.count": {
|
|
1031
|
-
method: "GET",
|
|
1032
|
-
path: "/audit-logs/count",
|
|
1033
|
-
pathParams: [],
|
|
1034
|
-
queryParams: [
|
|
1035
|
-
"search",
|
|
1036
|
-
"action",
|
|
1037
|
-
"actions",
|
|
1038
|
-
"resource_type",
|
|
1039
|
-
"resource_types",
|
|
1040
|
-
"auth_kind",
|
|
1041
|
-
"credential_id",
|
|
1042
|
-
"retention_class",
|
|
1043
|
-
"date_from",
|
|
1044
|
-
"date_to"
|
|
1045
|
-
],
|
|
1046
|
-
bodyKind: "none",
|
|
1047
|
-
responseKind: "json",
|
|
1048
|
-
codes: 11
|
|
1049
|
-
},
|
|
1050
|
-
"audit.exportCsv": {
|
|
1051
|
-
method: "GET",
|
|
1052
|
-
path: "/audit-logs/export",
|
|
1053
|
-
pathParams: [],
|
|
1054
|
-
queryParams: [
|
|
1055
|
-
"search",
|
|
1056
|
-
"action",
|
|
1057
|
-
"actions",
|
|
1058
|
-
"resource_type",
|
|
1059
|
-
"resource_types",
|
|
1060
|
-
"auth_kind",
|
|
1061
|
-
"credential_id",
|
|
1062
|
-
"retention_class",
|
|
1063
|
-
"date_from",
|
|
1064
|
-
"date_to"
|
|
1065
|
-
],
|
|
1066
|
-
bodyKind: "none",
|
|
1067
|
-
responseKind: "sse",
|
|
1068
|
-
codes: 11
|
|
1069
|
-
},
|
|
1070
|
-
"audit.list": {
|
|
1071
|
-
method: "GET",
|
|
1072
|
-
path: "/audit-logs",
|
|
1073
|
-
pathParams: [],
|
|
1074
|
-
queryParams: [
|
|
1075
|
-
"search",
|
|
1076
|
-
"page",
|
|
1077
|
-
"limit",
|
|
1078
|
-
"sort_by",
|
|
1079
|
-
"sort_order",
|
|
1080
|
-
"action",
|
|
1081
|
-
"actions",
|
|
1082
|
-
"resource_type",
|
|
1083
|
-
"resource_types",
|
|
1084
|
-
"auth_kind",
|
|
1085
|
-
"credential_id",
|
|
1086
|
-
"retention_class",
|
|
1087
|
-
"date_from",
|
|
1088
|
-
"date_to",
|
|
1089
|
-
"cursor"
|
|
1090
|
-
],
|
|
1091
|
-
bodyKind: "none",
|
|
1092
|
-
responseKind: "json",
|
|
1093
|
-
codes: 17
|
|
1094
|
-
},
|
|
1095
|
-
"bugReports.create": {
|
|
1096
|
-
method: "POST",
|
|
1097
|
-
path: "/bug-reports",
|
|
1098
|
-
pathParams: [],
|
|
1099
|
-
queryParams: [],
|
|
1100
|
-
bodyKind: "json",
|
|
1101
|
-
responseKind: "json",
|
|
1102
|
-
codes: 1
|
|
1103
|
-
},
|
|
1104
|
-
"callRecords.count": {
|
|
1105
|
-
method: "GET",
|
|
1106
|
-
path: "/call-records/count",
|
|
1107
|
-
pathParams: [],
|
|
1108
|
-
queryParams: [
|
|
1109
|
-
"search",
|
|
1110
|
-
"call_record_id",
|
|
1111
|
-
"uuid",
|
|
1112
|
-
"sip_call_id",
|
|
1113
|
-
"date_from",
|
|
1114
|
-
"date_to",
|
|
1115
|
-
"visual_plan_id",
|
|
1116
|
-
"channel_id",
|
|
1117
|
-
"status",
|
|
1118
|
-
"caller_search",
|
|
1119
|
-
"min_duration",
|
|
1120
|
-
"max_duration",
|
|
1121
|
-
"has_recording",
|
|
1122
|
-
"has_transcription",
|
|
1123
|
-
"recording_states",
|
|
1124
|
-
"transcription_states",
|
|
1125
|
-
"analysis_states",
|
|
1126
|
-
"has_error",
|
|
1127
|
-
"has_structured_analysis",
|
|
1128
|
-
"has_structured_analysis_error",
|
|
1129
|
-
"channel_type",
|
|
1130
|
-
"origin",
|
|
1131
|
-
"signal_id",
|
|
1132
|
-
"signal_triggered",
|
|
1133
|
-
"signal_value",
|
|
1134
|
-
"metadata"
|
|
1135
|
-
],
|
|
1136
|
-
bodyKind: "none",
|
|
1137
|
-
responseKind: "json",
|
|
1138
|
-
codes: 2
|
|
1139
|
-
},
|
|
1140
|
-
"callRecords.exportCsv": {
|
|
1141
|
-
method: "GET",
|
|
1142
|
-
path: "/call-records/export",
|
|
1143
|
-
pathParams: [],
|
|
1144
|
-
queryParams: [
|
|
1145
|
-
"date_from",
|
|
1146
|
-
"date_to",
|
|
1147
|
-
"visual_plan_id",
|
|
1148
|
-
"channel_id",
|
|
1149
|
-
"status",
|
|
1150
|
-
"search",
|
|
1151
|
-
"min_duration",
|
|
1152
|
-
"max_duration",
|
|
1153
|
-
"channel_type",
|
|
1154
|
-
"origin",
|
|
1155
|
-
"signal_id",
|
|
1156
|
-
"signal_triggered",
|
|
1157
|
-
"signal_value",
|
|
1158
|
-
"has_recording",
|
|
1159
|
-
"has_transcription",
|
|
1160
|
-
"recording_states",
|
|
1161
|
-
"transcription_states",
|
|
1162
|
-
"analysis_states",
|
|
1163
|
-
"has_error",
|
|
1164
|
-
"has_structured_analysis",
|
|
1165
|
-
"has_structured_analysis_error",
|
|
1166
|
-
"metadata",
|
|
1167
|
-
"apply_table_filters",
|
|
1168
|
-
"separator",
|
|
1169
|
-
"columns",
|
|
1170
|
-
"include_events"
|
|
1171
|
-
],
|
|
1172
|
-
bodyKind: "none",
|
|
1173
|
-
responseKind: "sse",
|
|
1174
|
-
codes: 10
|
|
1175
|
-
},
|
|
1176
|
-
"callRecords.getById": {
|
|
1177
|
-
method: "GET",
|
|
1178
|
-
path: "/call-records/{call_record_id}",
|
|
1179
|
-
pathParams: ["call_record_id"],
|
|
1180
|
-
queryParams: [],
|
|
1181
|
-
bodyKind: "none",
|
|
1182
|
-
responseKind: "json",
|
|
1183
|
-
codes: 2
|
|
1184
|
-
},
|
|
1185
|
-
"callRecords.getEvents": {
|
|
1186
|
-
method: "GET",
|
|
1187
|
-
path: "/call-records/{call_record_id}/events",
|
|
1188
|
-
pathParams: ["call_record_id"],
|
|
1189
|
-
queryParams: [],
|
|
1190
|
-
bodyKind: "none",
|
|
1191
|
-
responseKind: "json",
|
|
1192
|
-
codes: 2
|
|
1193
|
-
},
|
|
1194
|
-
"callRecords.getRecordingUrl": {
|
|
1195
|
-
method: "GET",
|
|
1196
|
-
path: "/call-records/{call_record_id}/recording-url",
|
|
1197
|
-
pathParams: ["call_record_id"],
|
|
1198
|
-
queryParams: ["ttl_seconds"],
|
|
1199
|
-
bodyKind: "none",
|
|
1200
|
-
responseKind: "json",
|
|
1201
|
-
codes: 2
|
|
1202
|
-
},
|
|
1203
|
-
"callRecords.list": {
|
|
1204
|
-
method: "GET",
|
|
1205
|
-
path: "/call-records",
|
|
1206
|
-
pathParams: [],
|
|
1207
|
-
queryParams: [
|
|
1208
|
-
"search",
|
|
1209
|
-
"page",
|
|
1210
|
-
"limit",
|
|
1211
|
-
"sort_by",
|
|
1212
|
-
"sort_order",
|
|
1213
|
-
"call_record_id",
|
|
1214
|
-
"uuid",
|
|
1215
|
-
"sip_call_id",
|
|
1216
|
-
"date_from",
|
|
1217
|
-
"date_to",
|
|
1218
|
-
"visual_plan_id",
|
|
1219
|
-
"channel_id",
|
|
1220
|
-
"status",
|
|
1221
|
-
"caller_search",
|
|
1222
|
-
"min_duration",
|
|
1223
|
-
"max_duration",
|
|
1224
|
-
"has_recording",
|
|
1225
|
-
"has_transcription",
|
|
1226
|
-
"recording_states",
|
|
1227
|
-
"transcription_states",
|
|
1228
|
-
"analysis_states",
|
|
1229
|
-
"has_error",
|
|
1230
|
-
"has_structured_analysis",
|
|
1231
|
-
"has_structured_analysis_error",
|
|
1232
|
-
"channel_type",
|
|
1233
|
-
"origin",
|
|
1234
|
-
"signal_id",
|
|
1235
|
-
"signal_triggered",
|
|
1236
|
-
"signal_value",
|
|
1237
|
-
"include_signals",
|
|
1238
|
-
"metadata",
|
|
1239
|
-
"cursor"
|
|
1240
|
-
],
|
|
1241
|
-
bodyKind: "none",
|
|
1242
|
-
responseKind: "json",
|
|
1243
|
-
codes: 4
|
|
1244
|
-
},
|
|
1245
|
-
"callRecords.purgeVoiceContent": {
|
|
1246
|
-
method: "POST",
|
|
1247
|
-
path: "/call-records/{call_record_id}/purge-voice",
|
|
1248
|
-
pathParams: ["call_record_id"],
|
|
1249
|
-
queryParams: [],
|
|
1250
|
-
bodyKind: "none",
|
|
1251
|
-
responseKind: "json",
|
|
1252
|
-
codes: 3
|
|
1253
|
-
},
|
|
1254
|
-
"callRecords.recordingContent": {
|
|
1255
|
-
method: "GET",
|
|
1256
|
-
path: "/call-records/{call_record_id}/recording",
|
|
1257
|
-
pathParams: ["call_record_id"],
|
|
1258
|
-
queryParams: [],
|
|
1259
|
-
bodyKind: "none",
|
|
1260
|
-
responseKind: "binary",
|
|
1261
|
-
codes: 35
|
|
1262
|
-
},
|
|
1263
|
-
"callRecords.retryRecording": {
|
|
1264
|
-
method: "POST",
|
|
1265
|
-
path: "/call-records/{call_record_id}/recording/retry",
|
|
1266
|
-
pathParams: ["call_record_id"],
|
|
1267
|
-
queryParams: [],
|
|
1268
|
-
bodyKind: "none",
|
|
1269
|
-
responseKind: "json",
|
|
1270
|
-
codes: 2
|
|
1271
|
-
},
|
|
1272
|
-
"calls.hangupCall": {
|
|
1273
|
-
method: "POST",
|
|
1274
|
-
path: "/calls/{call_id}/hangup",
|
|
1275
|
-
pathParams: ["call_id"],
|
|
1276
|
-
queryParams: [],
|
|
1277
|
-
bodyKind: "none",
|
|
1278
|
-
responseKind: "json",
|
|
1279
|
-
codes: 25
|
|
1280
|
-
},
|
|
1281
|
-
"calls.originate": {
|
|
1282
|
-
method: "POST",
|
|
1283
|
-
path: "/calls",
|
|
1284
|
-
pathParams: [],
|
|
1285
|
-
queryParams: [],
|
|
1286
|
-
bodyKind: "json",
|
|
1287
|
-
responseKind: "json",
|
|
1288
|
-
codes: 49
|
|
1289
|
-
},
|
|
1290
|
-
"capabilities.get": {
|
|
1291
|
-
method: "GET",
|
|
1292
|
-
path: "/capabilities",
|
|
1293
|
-
pathParams: [],
|
|
1294
|
-
queryParams: [],
|
|
1295
|
-
bodyKind: "none",
|
|
1296
|
-
responseKind: "json",
|
|
1297
|
-
codes: 0
|
|
1298
|
-
},
|
|
1299
|
-
"channels.create": {
|
|
1300
|
-
method: "POST",
|
|
1301
|
-
path: "/channels",
|
|
1302
|
-
pathParams: [],
|
|
1303
|
-
queryParams: [],
|
|
1304
|
-
bodyKind: "json",
|
|
1305
|
-
responseKind: "json",
|
|
1306
|
-
codes: 52
|
|
1307
|
-
},
|
|
1308
|
-
"channels.delete": {
|
|
1309
|
-
method: "DELETE",
|
|
1310
|
-
path: "/channels/{channel_id}",
|
|
1311
|
-
pathParams: ["channel_id"],
|
|
1312
|
-
queryParams: [],
|
|
1313
|
-
bodyKind: "none",
|
|
1314
|
-
responseKind: "json",
|
|
1315
|
-
codes: 52
|
|
1316
|
-
},
|
|
1317
|
-
"channels.getById": {
|
|
1318
|
-
method: "GET",
|
|
1319
|
-
path: "/channels/{channel_id}",
|
|
1320
|
-
pathParams: ["channel_id"],
|
|
1321
|
-
queryParams: [],
|
|
1322
|
-
bodyKind: "none",
|
|
1323
|
-
responseKind: "json",
|
|
1324
|
-
codes: 52
|
|
1325
|
-
},
|
|
1326
|
-
"channels.list": {
|
|
1327
|
-
method: "GET",
|
|
1328
|
-
path: "/channels",
|
|
1329
|
-
pathParams: [],
|
|
1330
|
-
queryParams: ["search", "page", "limit", "sort_by", "sort_order", "channel_type", "is_active", "alert"],
|
|
1331
|
-
bodyKind: "none",
|
|
1332
|
-
responseKind: "json",
|
|
1333
|
-
codes: 52
|
|
1334
|
-
},
|
|
1335
|
-
"channels.testConnection": {
|
|
1336
|
-
method: "POST",
|
|
1337
|
-
path: "/channels/test-connection",
|
|
1338
|
-
pathParams: [],
|
|
1339
|
-
queryParams: [],
|
|
1340
|
-
bodyKind: "json",
|
|
1341
|
-
responseKind: "json",
|
|
1342
|
-
codes: 52
|
|
1343
|
-
},
|
|
1344
|
-
"channels.toggle": {
|
|
1345
|
-
method: "POST",
|
|
1346
|
-
path: "/channels/{channel_id}/toggle-active",
|
|
1347
|
-
pathParams: ["channel_id"],
|
|
1348
|
-
queryParams: [],
|
|
1349
|
-
bodyKind: "json",
|
|
1350
|
-
responseKind: "json",
|
|
1351
|
-
codes: 52
|
|
1352
|
-
},
|
|
1353
|
-
"channels.update": {
|
|
1354
|
-
method: "PATCH",
|
|
1355
|
-
path: "/channels/{channel_id}",
|
|
1356
|
-
pathParams: ["channel_id"],
|
|
1357
|
-
queryParams: [],
|
|
1358
|
-
bodyKind: "json",
|
|
1359
|
-
responseKind: "json",
|
|
1360
|
-
codes: 52
|
|
1361
|
-
},
|
|
1362
|
-
"contacts.getById": {
|
|
1363
|
-
method: "GET",
|
|
1364
|
-
path: "/contacts/{contact_id}",
|
|
1365
|
-
pathParams: ["contact_id"],
|
|
1366
|
-
queryParams: [],
|
|
1367
|
-
bodyKind: "none",
|
|
1368
|
-
responseKind: "json",
|
|
1369
|
-
codes: 18
|
|
1370
|
-
},
|
|
1371
|
-
"contacts.list": {
|
|
1372
|
-
method: "GET",
|
|
1373
|
-
path: "/contacts",
|
|
1374
|
-
pathParams: [],
|
|
1375
|
-
queryParams: ["search", "page", "limit", "sort_by", "sort_order"],
|
|
1376
|
-
bodyKind: "none",
|
|
1377
|
-
responseKind: "json",
|
|
1378
|
-
codes: 11
|
|
1379
|
-
},
|
|
1380
|
-
"contacts.update": {
|
|
1381
|
-
method: "PATCH",
|
|
1382
|
-
path: "/contacts/{contact_id}",
|
|
1383
|
-
pathParams: ["contact_id"],
|
|
1384
|
-
queryParams: [],
|
|
1385
|
-
bodyKind: "json",
|
|
1386
|
-
responseKind: "json",
|
|
1387
|
-
codes: 18
|
|
1388
|
-
},
|
|
1389
|
-
"dashboard.capacityStatus": {
|
|
1390
|
-
method: "GET",
|
|
1391
|
-
path: "/capacity",
|
|
1392
|
-
pathParams: [],
|
|
1393
|
-
queryParams: [],
|
|
1394
|
-
bodyKind: "none",
|
|
1395
|
-
responseKind: "json",
|
|
1396
|
-
codes: 2
|
|
1397
|
-
},
|
|
1398
|
-
"dashboard.watchDashboardMetrics": {
|
|
1399
|
-
method: "GET",
|
|
1400
|
-
path: "/capacity/stream",
|
|
1401
|
-
pathParams: [],
|
|
1402
|
-
queryParams: [],
|
|
1403
|
-
bodyKind: "none",
|
|
1404
|
-
responseKind: "sse",
|
|
1405
|
-
codes: 2
|
|
1406
|
-
},
|
|
1407
|
-
"destinations.create": {
|
|
1408
|
-
method: "POST",
|
|
1409
|
-
path: "/destinations",
|
|
1410
|
-
pathParams: [],
|
|
1411
|
-
queryParams: [],
|
|
1412
|
-
bodyKind: "json",
|
|
1413
|
-
responseKind: "json",
|
|
1414
|
-
codes: 2
|
|
1415
|
-
},
|
|
1416
|
-
"destinations.delete": {
|
|
1417
|
-
method: "DELETE",
|
|
1418
|
-
path: "/destinations/{destination_id}",
|
|
1419
|
-
pathParams: ["destination_id"],
|
|
1420
|
-
queryParams: [],
|
|
1421
|
-
bodyKind: "none",
|
|
1422
|
-
responseKind: "json",
|
|
1423
|
-
codes: 5
|
|
1424
|
-
},
|
|
1425
|
-
"destinations.getById": {
|
|
1426
|
-
method: "GET",
|
|
1427
|
-
path: "/destinations/{destination_id}",
|
|
1428
|
-
pathParams: ["destination_id"],
|
|
1429
|
-
queryParams: [],
|
|
1430
|
-
bodyKind: "none",
|
|
1431
|
-
responseKind: "json",
|
|
1432
|
-
codes: 5
|
|
1433
|
-
},
|
|
1434
|
-
"destinations.list": {
|
|
1435
|
-
method: "GET",
|
|
1436
|
-
path: "/destinations",
|
|
1437
|
-
pathParams: [],
|
|
1438
|
-
queryParams: ["search", "page", "limit", "sort_by", "sort_order"],
|
|
1439
|
-
bodyKind: "none",
|
|
1440
|
-
responseKind: "json",
|
|
1441
|
-
codes: 2
|
|
1442
|
-
},
|
|
1443
|
-
"destinations.update": {
|
|
1444
|
-
method: "PATCH",
|
|
1445
|
-
path: "/destinations/{destination_id}",
|
|
1446
|
-
pathParams: ["destination_id"],
|
|
1447
|
-
queryParams: [],
|
|
1448
|
-
bodyKind: "json",
|
|
1449
|
-
responseKind: "json",
|
|
1450
|
-
codes: 5
|
|
1451
|
-
},
|
|
1452
|
-
"dialerAttempts.list": {
|
|
1453
|
-
method: "GET",
|
|
1454
|
-
path: "/dialer/campaigns/{campaign_id}/attempts",
|
|
1455
|
-
pathParams: ["campaign_id"],
|
|
1456
|
-
queryParams: ["search", "page", "limit", "sort_by", "sort_order", "date_from", "date_to", "status", "contact_id"],
|
|
1457
|
-
bodyKind: "none",
|
|
1458
|
-
responseKind: "json",
|
|
1459
|
-
codes: 11
|
|
1460
|
-
},
|
|
1461
|
-
"dialerCampaigns.control": {
|
|
1462
|
-
method: "POST",
|
|
1463
|
-
path: "/dialer/campaigns/{campaign_id}/control",
|
|
1464
|
-
pathParams: ["campaign_id"],
|
|
1465
|
-
queryParams: [],
|
|
1466
|
-
bodyKind: "json",
|
|
1467
|
-
responseKind: "json",
|
|
1468
|
-
codes: 45
|
|
1469
|
-
},
|
|
1470
|
-
"dialerCampaigns.create": {
|
|
1471
|
-
method: "POST",
|
|
1472
|
-
path: "/dialer/campaigns",
|
|
1473
|
-
pathParams: [],
|
|
1474
|
-
queryParams: [],
|
|
1475
|
-
bodyKind: "json",
|
|
1476
|
-
responseKind: "json",
|
|
1477
|
-
codes: 47
|
|
1478
|
-
},
|
|
1479
|
-
"dialerCampaigns.delete": {
|
|
1480
|
-
method: "DELETE",
|
|
1481
|
-
path: "/dialer/campaigns/{campaign_id}",
|
|
1482
|
-
pathParams: ["campaign_id"],
|
|
1483
|
-
queryParams: [],
|
|
1484
|
-
bodyKind: "none",
|
|
1485
|
-
responseKind: "json",
|
|
1486
|
-
codes: 45
|
|
1487
|
-
},
|
|
1488
|
-
"dialerCampaigns.get": {
|
|
1489
|
-
method: "GET",
|
|
1490
|
-
path: "/dialer/campaigns/{campaign_id}",
|
|
1491
|
-
pathParams: ["campaign_id"],
|
|
1492
|
-
queryParams: [],
|
|
1493
|
-
bodyKind: "none",
|
|
1494
|
-
responseKind: "json",
|
|
1495
|
-
codes: 45
|
|
1496
|
-
},
|
|
1497
|
-
"dialerCampaigns.list": {
|
|
1498
|
-
method: "GET",
|
|
1499
|
-
path: "/dialer/campaigns",
|
|
1500
|
-
pathParams: [],
|
|
1501
|
-
queryParams: ["search", "page", "limit", "sort_by", "sort_order", "status"],
|
|
1502
|
-
bodyKind: "none",
|
|
1503
|
-
responseKind: "json",
|
|
1504
|
-
codes: 11
|
|
1505
|
-
},
|
|
1506
|
-
"dialerCampaigns.liveStats": {
|
|
1507
|
-
method: "GET",
|
|
1508
|
-
path: "/dialer/campaigns/{campaign_id}/stats/stream",
|
|
1509
|
-
pathParams: ["campaign_id"],
|
|
1510
|
-
queryParams: [],
|
|
1511
|
-
bodyKind: "none",
|
|
1512
|
-
responseKind: "sse",
|
|
1513
|
-
codes: 45
|
|
1514
|
-
},
|
|
1515
|
-
"dialerCampaigns.orgLiveStats": {
|
|
1516
|
-
method: "GET",
|
|
1517
|
-
path: "/dialer/campaigns/stats/stream",
|
|
1518
|
-
pathParams: [],
|
|
1519
|
-
queryParams: [],
|
|
1520
|
-
bodyKind: "none",
|
|
1521
|
-
responseKind: "sse",
|
|
1522
|
-
codes: 11
|
|
1523
|
-
},
|
|
1524
|
-
"dialerCampaigns.stats": {
|
|
1525
|
-
method: "GET",
|
|
1526
|
-
path: "/dialer/campaigns/{campaign_id}/stats",
|
|
1527
|
-
pathParams: ["campaign_id"],
|
|
1528
|
-
queryParams: [],
|
|
1529
|
-
bodyKind: "none",
|
|
1530
|
-
responseKind: "json",
|
|
1531
|
-
codes: 45
|
|
1532
|
-
},
|
|
1533
|
-
"dialerCampaigns.summary": {
|
|
1534
|
-
method: "GET",
|
|
1535
|
-
path: "/dialer/campaigns/summary",
|
|
1536
|
-
pathParams: [],
|
|
1537
|
-
queryParams: [],
|
|
1538
|
-
bodyKind: "none",
|
|
1539
|
-
responseKind: "json",
|
|
1540
|
-
codes: 11
|
|
1541
|
-
},
|
|
1542
|
-
"dialerCampaigns.update": {
|
|
1543
|
-
method: "PATCH",
|
|
1544
|
-
path: "/dialer/campaigns/{campaign_id}",
|
|
1545
|
-
pathParams: ["campaign_id"],
|
|
1546
|
-
queryParams: [],
|
|
1547
|
-
bodyKind: "json",
|
|
1548
|
-
responseKind: "json",
|
|
1549
|
-
codes: 45
|
|
1550
|
-
},
|
|
1551
|
-
"dialerContacts.add": {
|
|
1552
|
-
method: "POST",
|
|
1553
|
-
path: "/dialer/campaigns/{campaign_id}/contacts",
|
|
1554
|
-
pathParams: ["campaign_id"],
|
|
1555
|
-
queryParams: [],
|
|
1556
|
-
bodyKind: "json",
|
|
1557
|
-
responseKind: "json",
|
|
1558
|
-
codes: 38
|
|
1559
|
-
},
|
|
1560
|
-
"dialerContacts.bulkCancel": {
|
|
1561
|
-
method: "POST",
|
|
1562
|
-
path: "/dialer/campaigns/{campaign_id}/contacts/bulk-cancel",
|
|
1563
|
-
pathParams: ["campaign_id"],
|
|
1564
|
-
queryParams: [],
|
|
1565
|
-
bodyKind: "json",
|
|
1566
|
-
responseKind: "json",
|
|
1567
|
-
codes: 11
|
|
1568
|
-
},
|
|
1569
|
-
"dialerContacts.bulkRequeue": {
|
|
1570
|
-
method: "POST",
|
|
1571
|
-
path: "/dialer/campaigns/{campaign_id}/contacts/bulk-requeue",
|
|
1572
|
-
pathParams: ["campaign_id"],
|
|
1573
|
-
queryParams: [],
|
|
1574
|
-
bodyKind: "json",
|
|
1575
|
-
responseKind: "json",
|
|
1576
|
-
codes: 11
|
|
1577
|
-
},
|
|
1578
|
-
"dialerContacts.cancel": {
|
|
1579
|
-
method: "POST",
|
|
1580
|
-
path: "/dialer/campaigns/{campaign_id}/contacts/{contact_id}/cancel",
|
|
1581
|
-
pathParams: ["campaign_id", "contact_id"],
|
|
1582
|
-
queryParams: [],
|
|
1583
|
-
bodyKind: "none",
|
|
1584
|
-
responseKind: "json",
|
|
1585
|
-
codes: 38
|
|
1586
|
-
},
|
|
1587
|
-
"dialerContacts.exportCsv": {
|
|
1588
|
-
method: "GET",
|
|
1589
|
-
path: "/dialer/campaigns/{campaign_id}/contacts/export",
|
|
1590
|
-
pathParams: ["campaign_id"],
|
|
1591
|
-
queryParams: ["date_from", "date_to", "status", "search"],
|
|
1592
|
-
bodyKind: "none",
|
|
1593
|
-
responseKind: "sse",
|
|
1594
|
-
codes: 11
|
|
1595
|
-
},
|
|
1596
|
-
"dialerContacts.get": {
|
|
1597
|
-
method: "GET",
|
|
1598
|
-
path: "/dialer/campaigns/{campaign_id}/contacts/{contact_id}",
|
|
1599
|
-
pathParams: ["campaign_id", "contact_id"],
|
|
1600
|
-
queryParams: [],
|
|
1601
|
-
bodyKind: "none",
|
|
1602
|
-
responseKind: "json",
|
|
1603
|
-
codes: 18
|
|
1604
|
-
},
|
|
1605
|
-
"dialerContacts.list": {
|
|
1606
|
-
method: "GET",
|
|
1607
|
-
path: "/dialer/campaigns/{campaign_id}/contacts",
|
|
1608
|
-
pathParams: ["campaign_id"],
|
|
1609
|
-
queryParams: ["search", "page", "limit", "sort_by", "sort_order", "date_from", "date_to", "status"],
|
|
1610
|
-
bodyKind: "none",
|
|
1611
|
-
responseKind: "json",
|
|
1612
|
-
codes: 11
|
|
1613
|
-
},
|
|
1614
|
-
"dialerContacts.remove": {
|
|
1615
|
-
method: "POST",
|
|
1616
|
-
path: "/dialer/campaigns/{campaign_id}/contacts/bulk-remove",
|
|
1617
|
-
pathParams: ["campaign_id"],
|
|
1618
|
-
queryParams: [],
|
|
1619
|
-
bodyKind: "json",
|
|
1620
|
-
responseKind: "json",
|
|
1621
|
-
codes: 11
|
|
1622
|
-
},
|
|
1623
|
-
"dialerContacts.requeue": {
|
|
1624
|
-
method: "POST",
|
|
1625
|
-
path: "/dialer/campaigns/{campaign_id}/contacts/{contact_id}/requeue",
|
|
1626
|
-
pathParams: ["campaign_id", "contact_id"],
|
|
1627
|
-
queryParams: [],
|
|
1628
|
-
bodyKind: "none",
|
|
1629
|
-
responseKind: "json",
|
|
1630
|
-
codes: 27
|
|
1631
|
-
},
|
|
1632
|
-
"dialerContacts.requeueAll": {
|
|
1633
|
-
method: "POST",
|
|
1634
|
-
path: "/dialer/campaigns/{campaign_id}/contacts/requeue-all",
|
|
1635
|
-
pathParams: ["campaign_id"],
|
|
1636
|
-
queryParams: [],
|
|
1637
|
-
bodyKind: "json",
|
|
1638
|
-
responseKind: "json",
|
|
1639
|
-
codes: 11
|
|
1640
|
-
},
|
|
1641
|
-
"dialerContacts.update": {
|
|
1642
|
-
method: "PATCH",
|
|
1643
|
-
path: "/dialer/campaigns/{campaign_id}/contacts/{contact_id}",
|
|
1644
|
-
pathParams: ["campaign_id", "contact_id"],
|
|
1645
|
-
queryParams: [],
|
|
1646
|
-
bodyKind: "json",
|
|
1647
|
-
responseKind: "json",
|
|
1648
|
-
codes: 42
|
|
1649
|
-
},
|
|
1650
|
-
"dialerDnc.add": {
|
|
1651
|
-
method: "POST",
|
|
1652
|
-
path: "/dialer/dnc",
|
|
1653
|
-
pathParams: [],
|
|
1654
|
-
queryParams: [],
|
|
1655
|
-
bodyKind: "json",
|
|
1656
|
-
responseKind: "json",
|
|
1657
|
-
codes: 28
|
|
1658
|
-
},
|
|
1659
|
-
"dialerDnc.bulkImport": {
|
|
1660
|
-
method: "POST",
|
|
1661
|
-
path: "/dialer/dnc/bulk-import",
|
|
1662
|
-
pathParams: [],
|
|
1663
|
-
queryParams: [],
|
|
1664
|
-
bodyKind: "json",
|
|
1665
|
-
responseKind: "json",
|
|
1666
|
-
codes: 11
|
|
1667
|
-
},
|
|
1668
|
-
"dialerDnc.bulkRemove": {
|
|
1669
|
-
method: "POST",
|
|
1670
|
-
path: "/dialer/dnc/bulk-remove",
|
|
1671
|
-
pathParams: [],
|
|
1672
|
-
queryParams: [],
|
|
1673
|
-
bodyKind: "json",
|
|
1674
|
-
responseKind: "json",
|
|
1675
|
-
codes: 11
|
|
1676
|
-
},
|
|
1677
|
-
"dialerDnc.list": {
|
|
1678
|
-
method: "GET",
|
|
1679
|
-
path: "/dialer/dnc",
|
|
1680
|
-
pathParams: [],
|
|
1681
|
-
queryParams: ["search", "page", "limit", "sort_by", "sort_order"],
|
|
1682
|
-
bodyKind: "none",
|
|
1683
|
-
responseKind: "json",
|
|
1684
|
-
codes: 11
|
|
1685
|
-
},
|
|
1686
|
-
"dialerDnc.remove": {
|
|
1687
|
-
method: "DELETE",
|
|
1688
|
-
path: "/dialer/dnc/{dnc_id}",
|
|
1689
|
-
pathParams: ["dnc_id"],
|
|
1690
|
-
queryParams: [],
|
|
1691
|
-
bodyKind: "none",
|
|
1692
|
-
responseKind: "json",
|
|
1693
|
-
codes: 11
|
|
1694
|
-
},
|
|
1695
|
-
"dialerImports.create": {
|
|
1696
|
-
method: "POST",
|
|
1697
|
-
path: "/dialer/campaigns/{campaign_id}/imports",
|
|
1698
|
-
pathParams: ["campaign_id"],
|
|
1699
|
-
queryParams: [],
|
|
1700
|
-
bodyKind: "json",
|
|
1701
|
-
responseKind: "json",
|
|
1702
|
-
codes: 39
|
|
1703
|
-
},
|
|
1704
|
-
"dialerImports.get": {
|
|
1705
|
-
method: "GET",
|
|
1706
|
-
path: "/dialer/imports/{import_job_id}",
|
|
1707
|
-
pathParams: ["import_job_id"],
|
|
1708
|
-
queryParams: [],
|
|
1709
|
-
bodyKind: "none",
|
|
1710
|
-
responseKind: "json",
|
|
1711
|
-
codes: 39
|
|
1712
|
-
},
|
|
1713
|
-
"dialerImports.invalidRows": {
|
|
1714
|
-
method: "GET",
|
|
1715
|
-
path: "/dialer/imports/{import_job_id}/invalid-rows",
|
|
1716
|
-
pathParams: ["import_job_id"],
|
|
1717
|
-
queryParams: [],
|
|
1718
|
-
bodyKind: "none",
|
|
1719
|
-
responseKind: "json",
|
|
1720
|
-
codes: 39
|
|
1721
|
-
},
|
|
1722
|
-
"dialerImports.progress": {
|
|
1723
|
-
method: "GET",
|
|
1724
|
-
path: "/dialer/imports/{import_job_id}/progress",
|
|
1725
|
-
pathParams: ["import_job_id"],
|
|
1726
|
-
queryParams: [],
|
|
1727
|
-
bodyKind: "none",
|
|
1728
|
-
responseKind: "sse",
|
|
1729
|
-
codes: 39
|
|
1730
|
-
},
|
|
1731
|
-
"holidays.countries": {
|
|
1732
|
-
method: "GET",
|
|
1733
|
-
path: "/holidays/countries",
|
|
1734
|
-
pathParams: [],
|
|
1735
|
-
queryParams: [],
|
|
1736
|
-
bodyKind: "none",
|
|
1737
|
-
responseKind: "json",
|
|
1738
|
-
codes: 12
|
|
1739
|
-
},
|
|
1740
|
-
"holidays.create": {
|
|
1741
|
-
method: "POST",
|
|
1742
|
-
path: "/holidays/groups/{holiday_group_id}/holidays",
|
|
1743
|
-
pathParams: ["holiday_group_id"],
|
|
1744
|
-
queryParams: [],
|
|
1745
|
-
bodyKind: "json",
|
|
1746
|
-
responseKind: "json",
|
|
1747
|
-
codes: 2
|
|
1748
|
-
},
|
|
1749
|
-
"holidays.delete": {
|
|
1750
|
-
method: "DELETE",
|
|
1751
|
-
path: "/holidays/{holiday_id}",
|
|
1752
|
-
pathParams: ["holiday_id"],
|
|
1753
|
-
queryParams: [],
|
|
1754
|
-
bodyKind: "none",
|
|
1755
|
-
responseKind: "json",
|
|
1756
|
-
codes: 7
|
|
1757
|
-
},
|
|
1758
|
-
"holidays.groups.create": {
|
|
1759
|
-
method: "POST",
|
|
1760
|
-
path: "/holidays/groups",
|
|
1761
|
-
pathParams: [],
|
|
1762
|
-
queryParams: [],
|
|
1763
|
-
bodyKind: "json",
|
|
1764
|
-
responseKind: "json",
|
|
1765
|
-
codes: 2
|
|
1766
|
-
},
|
|
1767
|
-
"holidays.groups.delete": {
|
|
1768
|
-
method: "DELETE",
|
|
1769
|
-
path: "/holidays/groups/{holiday_group_id}",
|
|
1770
|
-
pathParams: ["holiday_group_id"],
|
|
1771
|
-
queryParams: [],
|
|
1772
|
-
bodyKind: "none",
|
|
1773
|
-
responseKind: "json",
|
|
1774
|
-
codes: 6
|
|
1775
|
-
},
|
|
1776
|
-
"holidays.groups.getById": {
|
|
1777
|
-
method: "GET",
|
|
1778
|
-
path: "/holidays/groups/{holiday_group_id}",
|
|
1779
|
-
pathParams: ["holiday_group_id"],
|
|
1780
|
-
queryParams: [],
|
|
1781
|
-
bodyKind: "none",
|
|
1782
|
-
responseKind: "json",
|
|
1783
|
-
codes: 6
|
|
1784
|
-
},
|
|
1785
|
-
"holidays.groups.list": {
|
|
1786
|
-
method: "GET",
|
|
1787
|
-
path: "/holidays/groups",
|
|
1788
|
-
pathParams: [],
|
|
1789
|
-
queryParams: ["search", "page", "limit", "sort_by", "sort_order"],
|
|
1790
|
-
bodyKind: "none",
|
|
1791
|
-
responseKind: "json",
|
|
1792
|
-
codes: 2
|
|
1793
|
-
},
|
|
1794
|
-
"holidays.groups.update": {
|
|
1795
|
-
method: "PATCH",
|
|
1796
|
-
path: "/holidays/groups/{holiday_group_id}",
|
|
1797
|
-
pathParams: ["holiday_group_id"],
|
|
1798
|
-
queryParams: [],
|
|
1799
|
-
bodyKind: "json",
|
|
1800
|
-
responseKind: "json",
|
|
1801
|
-
codes: 6
|
|
1802
|
-
},
|
|
1803
|
-
"holidays.import": {
|
|
1804
|
-
method: "POST",
|
|
1805
|
-
path: "/holidays/groups/{holiday_group_id}/import",
|
|
1806
|
-
pathParams: ["holiday_group_id"],
|
|
1807
|
-
queryParams: [],
|
|
1808
|
-
bodyKind: "json",
|
|
1809
|
-
responseKind: "json",
|
|
1810
|
-
codes: 19
|
|
1811
|
-
},
|
|
1812
|
-
"holidays.list": {
|
|
1813
|
-
method: "GET",
|
|
1814
|
-
path: "/holidays/groups/{holiday_group_id}/holidays",
|
|
1815
|
-
pathParams: ["holiday_group_id"],
|
|
1816
|
-
queryParams: ["page", "limit"],
|
|
1817
|
-
bodyKind: "none",
|
|
1818
|
-
responseKind: "json",
|
|
1819
|
-
codes: 2
|
|
1820
|
-
},
|
|
1821
|
-
"holidays.previewImport": {
|
|
1822
|
-
method: "GET",
|
|
1823
|
-
path: "/holidays/preview",
|
|
1824
|
-
pathParams: [],
|
|
1825
|
-
queryParams: ["country_code", "year"],
|
|
1826
|
-
bodyKind: "none",
|
|
1827
|
-
responseKind: "json",
|
|
1828
|
-
codes: 12
|
|
1829
|
-
},
|
|
1830
|
-
"holidays.update": {
|
|
1831
|
-
method: "PATCH",
|
|
1832
|
-
path: "/holidays/{holiday_id}",
|
|
1833
|
-
pathParams: ["holiday_id"],
|
|
1834
|
-
queryParams: [],
|
|
1835
|
-
bodyKind: "json",
|
|
1836
|
-
responseKind: "json",
|
|
1837
|
-
codes: 7
|
|
1838
|
-
},
|
|
1839
|
-
"insights.aggregate": {
|
|
1840
|
-
method: "POST",
|
|
1841
|
-
path: "/insights/aggregate",
|
|
1842
|
-
pathParams: [],
|
|
1843
|
-
queryParams: [],
|
|
1844
|
-
bodyKind: "json",
|
|
1845
|
-
responseKind: "json",
|
|
1846
|
-
codes: 20
|
|
1847
|
-
},
|
|
1848
|
-
"license.modules": {
|
|
1849
|
-
method: "GET",
|
|
1850
|
-
path: "/license/modules",
|
|
1851
|
-
pathParams: [],
|
|
1852
|
-
queryParams: [],
|
|
1853
|
-
bodyKind: "none",
|
|
1854
|
-
responseKind: "json",
|
|
1855
|
-
codes: 0
|
|
1856
|
-
},
|
|
1857
|
-
"license.status": {
|
|
1858
|
-
method: "GET",
|
|
1859
|
-
path: "/license/status",
|
|
1860
|
-
pathParams: [],
|
|
1861
|
-
queryParams: [],
|
|
1862
|
-
bodyKind: "none",
|
|
1863
|
-
responseKind: "json",
|
|
1864
|
-
codes: 2
|
|
1865
|
-
},
|
|
1866
|
-
"nodes.list": {
|
|
1867
|
-
method: "GET",
|
|
1868
|
-
path: "/nodes",
|
|
1869
|
-
pathParams: [],
|
|
1870
|
-
queryParams: [],
|
|
1871
|
-
bodyKind: "none",
|
|
1872
|
-
responseKind: "json",
|
|
1873
|
-
codes: 0
|
|
1874
|
-
},
|
|
1875
|
-
"nodes.schema": {
|
|
1876
|
-
method: "GET",
|
|
1877
|
-
path: "/nodes/{node_type}/schema",
|
|
1878
|
-
pathParams: ["node_type"],
|
|
1879
|
-
queryParams: [],
|
|
1880
|
-
bodyKind: "none",
|
|
1881
|
-
responseKind: "json",
|
|
1882
|
-
codes: 0
|
|
1883
|
-
},
|
|
1884
|
-
"oauthGrants.list": {
|
|
1885
|
-
method: "GET",
|
|
1886
|
-
path: "/oauth-grants",
|
|
1887
|
-
pathParams: [],
|
|
1888
|
-
queryParams: ["search", "page", "limit", "sort_by", "sort_order"],
|
|
1889
|
-
bodyKind: "none",
|
|
1890
|
-
responseKind: "json",
|
|
1891
|
-
codes: 2
|
|
1892
|
-
},
|
|
1893
|
-
"oauthGrants.revoke": {
|
|
1894
|
-
method: "DELETE",
|
|
1895
|
-
path: "/oauth-grants/{oauth_grant_id}",
|
|
1896
|
-
pathParams: ["oauth_grant_id"],
|
|
1897
|
-
queryParams: [],
|
|
1898
|
-
bodyKind: "none",
|
|
1899
|
-
responseKind: "json",
|
|
1900
|
-
codes: 24
|
|
1901
|
-
},
|
|
1902
|
-
"oauthGrants.usage": {
|
|
1903
|
-
method: "GET",
|
|
1904
|
-
path: "/oauth-grants/{oauth_grant_id}/usage",
|
|
1905
|
-
pathParams: ["oauth_grant_id"],
|
|
1906
|
-
queryParams: ["days"],
|
|
1907
|
-
bodyKind: "none",
|
|
1908
|
-
responseKind: "json",
|
|
1909
|
-
codes: 24
|
|
1910
|
-
},
|
|
1911
|
-
"orgSettings.getDialer": {
|
|
1912
|
-
method: "GET",
|
|
1913
|
-
path: "/organization/dialer-settings",
|
|
1914
|
-
pathParams: [],
|
|
1915
|
-
queryParams: [],
|
|
1916
|
-
bodyKind: "none",
|
|
1917
|
-
responseKind: "json",
|
|
1918
|
-
codes: 2
|
|
1919
|
-
},
|
|
1920
|
-
"orgSettings.upsertDialer": {
|
|
1921
|
-
method: "PATCH",
|
|
1922
|
-
path: "/organization/dialer-settings",
|
|
1923
|
-
pathParams: [],
|
|
1924
|
-
queryParams: [],
|
|
1925
|
-
bodyKind: "json",
|
|
1926
|
-
responseKind: "json",
|
|
1927
|
-
codes: 2
|
|
1928
|
-
},
|
|
1929
|
-
"schedules.create": {
|
|
1930
|
-
method: "POST",
|
|
1931
|
-
path: "/schedules",
|
|
1932
|
-
pathParams: [],
|
|
1933
|
-
queryParams: [],
|
|
1934
|
-
bodyKind: "json",
|
|
1935
|
-
responseKind: "json",
|
|
1936
|
-
codes: 2
|
|
1937
|
-
},
|
|
1938
|
-
"schedules.delete": {
|
|
1939
|
-
method: "DELETE",
|
|
1940
|
-
path: "/schedules/{schedule_id}",
|
|
1941
|
-
pathParams: ["schedule_id"],
|
|
1942
|
-
queryParams: [],
|
|
1943
|
-
bodyKind: "none",
|
|
1944
|
-
responseKind: "json",
|
|
1945
|
-
codes: 13
|
|
1946
|
-
},
|
|
1947
|
-
"schedules.getById": {
|
|
1948
|
-
method: "GET",
|
|
1949
|
-
path: "/schedules/{schedule_id}",
|
|
1950
|
-
pathParams: ["schedule_id"],
|
|
1951
|
-
queryParams: [],
|
|
1952
|
-
bodyKind: "none",
|
|
1953
|
-
responseKind: "json",
|
|
1954
|
-
codes: 13
|
|
1955
|
-
},
|
|
1956
|
-
"schedules.list": {
|
|
1957
|
-
method: "GET",
|
|
1958
|
-
path: "/schedules",
|
|
1959
|
-
pathParams: [],
|
|
1960
|
-
queryParams: ["search", "page", "limit", "sort_by", "sort_order"],
|
|
1961
|
-
bodyKind: "none",
|
|
1962
|
-
responseKind: "json",
|
|
1963
|
-
codes: 2
|
|
1964
|
-
},
|
|
1965
|
-
"schedules.update": {
|
|
1966
|
-
method: "PATCH",
|
|
1967
|
-
path: "/schedules/{schedule_id}",
|
|
1968
|
-
pathParams: ["schedule_id"],
|
|
1969
|
-
queryParams: [],
|
|
1970
|
-
bodyKind: "json",
|
|
1971
|
-
responseKind: "json",
|
|
1972
|
-
codes: 13
|
|
1973
|
-
},
|
|
1974
|
-
"secrets.list": {
|
|
1975
|
-
method: "GET",
|
|
1976
|
-
path: "/secrets",
|
|
1977
|
-
pathParams: [],
|
|
1978
|
-
queryParams: ["search", "page", "limit", "sort_by", "sort_order"],
|
|
1979
|
-
bodyKind: "none",
|
|
1980
|
-
responseKind: "json",
|
|
1981
|
-
codes: 2
|
|
1982
|
-
},
|
|
1983
|
-
"secrets.listNames": {
|
|
1984
|
-
method: "GET",
|
|
1985
|
-
path: "/secrets/names",
|
|
1986
|
-
pathParams: [],
|
|
1987
|
-
queryParams: [],
|
|
1988
|
-
bodyKind: "none",
|
|
1989
|
-
responseKind: "json",
|
|
1990
|
-
codes: 2
|
|
1991
|
-
},
|
|
1992
|
-
"signals.callSignals": {
|
|
1993
|
-
method: "GET",
|
|
1994
|
-
path: "/call-records/{call_id}/signals",
|
|
1995
|
-
pathParams: ["call_id"],
|
|
1996
|
-
queryParams: ["locale"],
|
|
1997
|
-
bodyKind: "none",
|
|
1998
|
-
responseKind: "json",
|
|
1999
|
-
codes: 53
|
|
2000
|
-
},
|
|
2001
|
-
"signals.create": {
|
|
2002
|
-
method: "POST",
|
|
2003
|
-
path: "/signals",
|
|
2004
|
-
pathParams: [],
|
|
2005
|
-
queryParams: [],
|
|
2006
|
-
bodyKind: "json",
|
|
2007
|
-
responseKind: "json",
|
|
2008
|
-
codes: 53
|
|
2009
|
-
},
|
|
2010
|
-
"signals.delete": {
|
|
2011
|
-
method: "DELETE",
|
|
2012
|
-
path: "/signals/{signal_id}",
|
|
2013
|
-
pathParams: ["signal_id"],
|
|
2014
|
-
queryParams: [],
|
|
2015
|
-
bodyKind: "none",
|
|
2016
|
-
responseKind: "json",
|
|
2017
|
-
codes: 53
|
|
2018
|
-
},
|
|
2019
|
-
"signals.get": {
|
|
2020
|
-
method: "GET",
|
|
2021
|
-
path: "/signals/{signal_id}",
|
|
2022
|
-
pathParams: ["signal_id"],
|
|
2023
|
-
queryParams: [],
|
|
2024
|
-
bodyKind: "none",
|
|
2025
|
-
responseKind: "json",
|
|
2026
|
-
codes: 53
|
|
2027
|
-
},
|
|
2028
|
-
"signals.list": {
|
|
2029
|
-
method: "GET",
|
|
2030
|
-
path: "/signals",
|
|
2031
|
-
pathParams: [],
|
|
2032
|
-
queryParams: ["search", "page", "limit", "sort_by", "sort_order", "include_archived"],
|
|
2033
|
-
bodyKind: "none",
|
|
2034
|
-
responseKind: "json",
|
|
2035
|
-
codes: 11
|
|
2036
|
-
},
|
|
2037
|
-
"signals.overview": {
|
|
2038
|
-
method: "GET",
|
|
2039
|
-
path: "/signals/overview",
|
|
2040
|
-
pathParams: [],
|
|
2041
|
-
queryParams: [],
|
|
2042
|
-
bodyKind: "none",
|
|
2043
|
-
responseKind: "json",
|
|
2044
|
-
codes: 11
|
|
2045
|
-
},
|
|
2046
|
-
"signals.presets": {
|
|
2047
|
-
method: "GET",
|
|
2048
|
-
path: "/signals/presets",
|
|
2049
|
-
pathParams: [],
|
|
2050
|
-
queryParams: ["locale"],
|
|
2051
|
-
bodyKind: "none",
|
|
2052
|
-
responseKind: "json",
|
|
2053
|
-
codes: 11
|
|
2054
|
-
},
|
|
2055
|
-
"signals.test": {
|
|
2056
|
-
method: "POST",
|
|
2057
|
-
path: "/signals/test",
|
|
2058
|
-
pathParams: [],
|
|
2059
|
-
queryParams: [],
|
|
2060
|
-
bodyKind: "json",
|
|
2061
|
-
responseKind: "json",
|
|
2062
|
-
codes: 53
|
|
2063
|
-
},
|
|
2064
|
-
"signals.update": {
|
|
2065
|
-
method: "PATCH",
|
|
2066
|
-
path: "/signals/{signal_id}",
|
|
2067
|
-
pathParams: ["signal_id"],
|
|
2068
|
-
queryParams: [],
|
|
2069
|
-
bodyKind: "json",
|
|
2070
|
-
responseKind: "json",
|
|
2071
|
-
codes: 53
|
|
2072
|
-
},
|
|
2073
|
-
"signals.upsertBySlug": {
|
|
2074
|
-
method: "PUT",
|
|
2075
|
-
path: "/signals/by-slug/{slug}",
|
|
2076
|
-
pathParams: ["slug"],
|
|
2077
|
-
queryParams: [],
|
|
2078
|
-
bodyKind: "json",
|
|
2079
|
-
responseKind: "json",
|
|
2080
|
-
codes: 53
|
|
2081
|
-
},
|
|
2082
|
-
"tts.listModels": {
|
|
2083
|
-
method: "GET",
|
|
2084
|
-
path: "/tts/models",
|
|
2085
|
-
pathParams: [],
|
|
2086
|
-
queryParams: [],
|
|
2087
|
-
bodyKind: "none",
|
|
2088
|
-
responseKind: "json",
|
|
2089
|
-
codes: 26
|
|
2090
|
-
},
|
|
2091
|
-
"tts.listVoices": {
|
|
2092
|
-
method: "GET",
|
|
2093
|
-
path: "/tts/voices",
|
|
2094
|
-
pathParams: [],
|
|
2095
|
-
queryParams: ["language", "model"],
|
|
2096
|
-
bodyKind: "none",
|
|
2097
|
-
responseKind: "json",
|
|
2098
|
-
codes: 26
|
|
2099
|
-
},
|
|
2100
|
-
"tts.preview": {
|
|
2101
|
-
method: "POST",
|
|
2102
|
-
path: "/tts/preview",
|
|
2103
|
-
pathParams: [],
|
|
2104
|
-
queryParams: [],
|
|
2105
|
-
bodyKind: "json",
|
|
2106
|
-
responseKind: "binary",
|
|
2107
|
-
codes: 33
|
|
2108
|
-
},
|
|
2109
|
-
"users.activateMember": {
|
|
2110
|
-
method: "POST",
|
|
2111
|
-
path: "/members/{user_id}/activate",
|
|
2112
|
-
pathParams: ["user_id"],
|
|
2113
|
-
queryParams: [],
|
|
2114
|
-
bodyKind: "none",
|
|
2115
|
-
responseKind: "json",
|
|
2116
|
-
codes: 22
|
|
2117
|
-
},
|
|
2118
|
-
"users.createMember": {
|
|
2119
|
-
method: "POST",
|
|
2120
|
-
path: "/members",
|
|
2121
|
-
pathParams: [],
|
|
2122
|
-
queryParams: [],
|
|
2123
|
-
bodyKind: "json",
|
|
2124
|
-
responseKind: "json",
|
|
2125
|
-
codes: 48
|
|
2126
|
-
},
|
|
2127
|
-
"users.listMembers": {
|
|
2128
|
-
method: "GET",
|
|
2129
|
-
path: "/members",
|
|
2130
|
-
pathParams: [],
|
|
2131
|
-
queryParams: ["search", "page", "limit", "sort_by", "sort_order", "status"],
|
|
2132
|
-
bodyKind: "none",
|
|
2133
|
-
responseKind: "json",
|
|
2134
|
-
codes: 2
|
|
2135
|
-
},
|
|
2136
|
-
"users.me": {
|
|
2137
|
-
method: "GET",
|
|
2138
|
-
path: "/users/me",
|
|
2139
|
-
pathParams: [],
|
|
2140
|
-
queryParams: [],
|
|
2141
|
-
bodyKind: "none",
|
|
2142
|
-
responseKind: "json",
|
|
2143
|
-
codes: 0
|
|
2144
|
-
},
|
|
2145
|
-
"users.removeMember": {
|
|
2146
|
-
method: "DELETE",
|
|
2147
|
-
path: "/members/{user_id}",
|
|
2148
|
-
pathParams: ["user_id"],
|
|
2149
|
-
queryParams: [],
|
|
2150
|
-
bodyKind: "none",
|
|
2151
|
-
responseKind: "json",
|
|
2152
|
-
codes: 36
|
|
2153
|
-
},
|
|
2154
|
-
"users.resetSecondFactor": {
|
|
2155
|
-
method: "POST",
|
|
2156
|
-
path: "/members/{user_id}/reset-second-factor",
|
|
2157
|
-
pathParams: ["user_id"],
|
|
2158
|
-
queryParams: [],
|
|
2159
|
-
bodyKind: "none",
|
|
2160
|
-
responseKind: "json",
|
|
2161
|
-
codes: 32
|
|
2162
|
-
},
|
|
2163
|
-
"users.revokeMemberSessions": {
|
|
2164
|
-
method: "POST",
|
|
2165
|
-
path: "/members/{user_id}/revoke-sessions",
|
|
2166
|
-
pathParams: ["user_id"],
|
|
2167
|
-
queryParams: [],
|
|
2168
|
-
bodyKind: "none",
|
|
2169
|
-
responseKind: "json",
|
|
2170
|
-
codes: 32
|
|
2171
|
-
},
|
|
2172
|
-
"users.suspendMember": {
|
|
2173
|
-
method: "POST",
|
|
2174
|
-
path: "/members/{user_id}/suspend",
|
|
2175
|
-
pathParams: ["user_id"],
|
|
2176
|
-
queryParams: [],
|
|
2177
|
-
bodyKind: "none",
|
|
2178
|
-
responseKind: "json",
|
|
2179
|
-
codes: 37
|
|
2180
|
-
},
|
|
2181
|
-
"users.unlockMember": {
|
|
2182
|
-
method: "POST",
|
|
2183
|
-
path: "/members/{user_id}/unlock",
|
|
2184
|
-
pathParams: ["user_id"],
|
|
2185
|
-
queryParams: [],
|
|
2186
|
-
bodyKind: "none",
|
|
2187
|
-
responseKind: "json",
|
|
2188
|
-
codes: 32
|
|
2189
|
-
},
|
|
2190
|
-
"users.updateMyNotificationEmail": {
|
|
2191
|
-
method: "PUT",
|
|
2192
|
-
path: "/users/me/notification-email",
|
|
2193
|
-
pathParams: [],
|
|
2194
|
-
queryParams: [],
|
|
2195
|
-
bodyKind: "json",
|
|
2196
|
-
responseKind: "json",
|
|
2197
|
-
codes: 0
|
|
2198
|
-
},
|
|
2199
|
-
"users.updateMyNotificationToast": {
|
|
2200
|
-
method: "PUT",
|
|
2201
|
-
path: "/users/me/notification-toast",
|
|
2202
|
-
pathParams: [],
|
|
2203
|
-
queryParams: [],
|
|
2204
|
-
bodyKind: "json",
|
|
2205
|
-
responseKind: "json",
|
|
2206
|
-
codes: 0
|
|
2207
|
-
},
|
|
2208
|
-
"users.updateRole": {
|
|
2209
|
-
method: "PATCH",
|
|
2210
|
-
path: "/members/{user_id}/role",
|
|
2211
|
-
pathParams: ["user_id"],
|
|
2212
|
-
queryParams: [],
|
|
2213
|
-
bodyKind: "json",
|
|
2214
|
-
responseKind: "json",
|
|
2215
|
-
codes: 44
|
|
2216
|
-
},
|
|
2217
|
-
"visualPlans.clone": {
|
|
2218
|
-
method: "POST",
|
|
2219
|
-
path: "/visual-plans/{plan_id}/clone",
|
|
2220
|
-
pathParams: ["plan_id"],
|
|
2221
|
-
queryParams: [],
|
|
2222
|
-
bodyKind: "json",
|
|
2223
|
-
responseKind: "json",
|
|
2224
|
-
codes: 31
|
|
2225
|
-
},
|
|
2226
|
-
"visualPlans.create": {
|
|
2227
|
-
method: "POST",
|
|
2228
|
-
path: "/visual-plans",
|
|
2229
|
-
pathParams: [],
|
|
2230
|
-
queryParams: [],
|
|
2231
|
-
bodyKind: "json",
|
|
2232
|
-
responseKind: "json",
|
|
2233
|
-
codes: 31
|
|
2234
|
-
},
|
|
2235
|
-
"visualPlans.delete": {
|
|
2236
|
-
method: "DELETE",
|
|
2237
|
-
path: "/visual-plans/{plan_id}",
|
|
2238
|
-
pathParams: ["plan_id"],
|
|
2239
|
-
queryParams: [],
|
|
2240
|
-
bodyKind: "none",
|
|
2241
|
-
responseKind: "json",
|
|
2242
|
-
codes: 40
|
|
2243
|
-
},
|
|
2244
|
-
"visualPlans.getById": {
|
|
2245
|
-
method: "GET",
|
|
2246
|
-
path: "/visual-plans/{plan_id}",
|
|
2247
|
-
pathParams: ["plan_id"],
|
|
2248
|
-
queryParams: [],
|
|
2249
|
-
bodyKind: "none",
|
|
2250
|
-
responseKind: "json",
|
|
2251
|
-
codes: 31
|
|
2252
|
-
},
|
|
2253
|
-
"visualPlans.importDraft": {
|
|
2254
|
-
method: "POST",
|
|
2255
|
-
path: "/visual-plans/{plan_id}/import",
|
|
2256
|
-
pathParams: ["plan_id"],
|
|
2257
|
-
queryParams: [],
|
|
2258
|
-
bodyKind: "json",
|
|
2259
|
-
responseKind: "json",
|
|
2260
|
-
codes: 31
|
|
2261
|
-
},
|
|
2262
|
-
"visualPlans.list": {
|
|
2263
|
-
method: "GET",
|
|
2264
|
-
path: "/visual-plans",
|
|
2265
|
-
pathParams: [],
|
|
2266
|
-
queryParams: ["search", "page", "limit", "sort_by", "sort_order", "status"],
|
|
2267
|
-
bodyKind: "none",
|
|
2268
|
-
responseKind: "json",
|
|
2269
|
-
codes: 2
|
|
2270
|
-
},
|
|
2271
|
-
"visualPlans.listVersions": {
|
|
2272
|
-
method: "GET",
|
|
2273
|
-
path: "/visual-plans/{plan_id}/versions",
|
|
2274
|
-
pathParams: ["plan_id"],
|
|
2275
|
-
queryParams: [],
|
|
2276
|
-
bodyKind: "none",
|
|
2277
|
-
responseKind: "json",
|
|
2278
|
-
codes: 31
|
|
2279
|
-
},
|
|
2280
|
-
"visualPlans.publish": {
|
|
2281
|
-
method: "POST",
|
|
2282
|
-
path: "/visual-plans/{plan_id}/publish",
|
|
2283
|
-
pathParams: ["plan_id"],
|
|
2284
|
-
queryParams: [],
|
|
2285
|
-
bodyKind: "json",
|
|
2286
|
-
responseKind: "json",
|
|
2287
|
-
codes: 43
|
|
2288
|
-
},
|
|
2289
|
-
"visualPlans.update": {
|
|
2290
|
-
method: "PATCH",
|
|
2291
|
-
path: "/visual-plans/{plan_id}",
|
|
2292
|
-
pathParams: ["plan_id"],
|
|
2293
|
-
queryParams: [],
|
|
2294
|
-
bodyKind: "json",
|
|
2295
|
-
responseKind: "json",
|
|
2296
|
-
codes: 31
|
|
2297
|
-
},
|
|
2298
|
-
"visualPlans.validate": {
|
|
2299
|
-
method: "POST",
|
|
2300
|
-
path: "/visual-plans/validate",
|
|
2301
|
-
pathParams: [],
|
|
2302
|
-
queryParams: [],
|
|
2303
|
-
bodyKind: "json",
|
|
2304
|
-
responseKind: "json",
|
|
2305
|
-
codes: 31
|
|
2306
|
-
},
|
|
2307
|
-
"webhooks.deliveries.aggregates.get": {
|
|
2308
|
-
method: "GET",
|
|
2309
|
-
path: "/webhooks/deliveries/aggregates/{day}",
|
|
2310
|
-
pathParams: ["day"],
|
|
2311
|
-
queryParams: ["webhook_endpoint_id"],
|
|
2312
|
-
bodyKind: "none",
|
|
2313
|
-
responseKind: "json",
|
|
2314
|
-
codes: 8
|
|
2315
|
-
},
|
|
2316
|
-
"webhooks.deliveries.aggregates.list": {
|
|
2317
|
-
method: "GET",
|
|
2318
|
-
path: "/webhooks/deliveries/aggregates",
|
|
2319
|
-
pathParams: [],
|
|
2320
|
-
queryParams: [
|
|
2321
|
-
"limit",
|
|
2322
|
-
"cursor",
|
|
2323
|
-
"sort_order",
|
|
2324
|
-
"webhook_endpoint_id",
|
|
2325
|
-
"event_type",
|
|
2326
|
-
"outcome",
|
|
2327
|
-
"http_class",
|
|
2328
|
-
"date_from",
|
|
2329
|
-
"date_to"
|
|
2330
|
-
],
|
|
2331
|
-
bodyKind: "none",
|
|
2332
|
-
responseKind: "json",
|
|
2333
|
-
codes: 9
|
|
2334
|
-
},
|
|
2335
|
-
"webhooks.deliveries.count": {
|
|
2336
|
-
method: "GET",
|
|
2337
|
-
path: "/webhooks/deliveries/count",
|
|
2338
|
-
pathParams: [],
|
|
2339
|
-
queryParams: ["webhook_endpoint_id", "event_type", "status", "date_from", "date_to"],
|
|
2340
|
-
bodyKind: "none",
|
|
2341
|
-
responseKind: "json",
|
|
2342
|
-
codes: 2
|
|
2343
|
-
},
|
|
2344
|
-
"webhooks.deliveries.getById": {
|
|
2345
|
-
method: "GET",
|
|
2346
|
-
path: "/webhooks/deliveries/{delivery_log_id}",
|
|
2347
|
-
pathParams: ["delivery_log_id"],
|
|
2348
|
-
queryParams: [],
|
|
2349
|
-
bodyKind: "none",
|
|
2350
|
-
responseKind: "json",
|
|
2351
|
-
codes: 2
|
|
2352
|
-
},
|
|
2353
|
-
"webhooks.deliveries.list": {
|
|
2354
|
-
method: "GET",
|
|
2355
|
-
path: "/webhooks/deliveries",
|
|
2356
|
-
pathParams: [],
|
|
2357
|
-
queryParams: [
|
|
2358
|
-
"limit",
|
|
2359
|
-
"cursor",
|
|
2360
|
-
"sort_order",
|
|
2361
|
-
"webhook_endpoint_id",
|
|
2362
|
-
"event_type",
|
|
2363
|
-
"status",
|
|
2364
|
-
"date_from",
|
|
2365
|
-
"date_to"
|
|
2366
|
-
],
|
|
2367
|
-
bodyKind: "none",
|
|
2368
|
-
responseKind: "json",
|
|
2369
|
-
codes: 9
|
|
2370
|
-
},
|
|
2371
|
-
"webhooks.deliveries.retention": {
|
|
2372
|
-
method: "GET",
|
|
2373
|
-
path: "/webhooks/deliveries/retention",
|
|
2374
|
-
pathParams: [],
|
|
2375
|
-
queryParams: [],
|
|
2376
|
-
bodyKind: "none",
|
|
2377
|
-
responseKind: "json",
|
|
2378
|
-
codes: 2
|
|
2379
|
-
},
|
|
2380
|
-
"webhooks.deliveries.retry": {
|
|
2381
|
-
method: "POST",
|
|
2382
|
-
path: "/webhooks/deliveries/{delivery_log_id}/retry",
|
|
2383
|
-
pathParams: ["delivery_log_id"],
|
|
2384
|
-
queryParams: [],
|
|
2385
|
-
bodyKind: "none",
|
|
2386
|
-
responseKind: "json",
|
|
2387
|
-
codes: 21
|
|
2388
|
-
},
|
|
2389
|
-
"webhooks.endpoints.create": {
|
|
2390
|
-
method: "POST",
|
|
2391
|
-
path: "/webhooks",
|
|
2392
|
-
pathParams: [],
|
|
2393
|
-
queryParams: [],
|
|
2394
|
-
bodyKind: "json",
|
|
2395
|
-
responseKind: "json",
|
|
2396
|
-
codes: 23
|
|
2397
|
-
},
|
|
2398
|
-
"webhooks.endpoints.delete": {
|
|
2399
|
-
method: "DELETE",
|
|
2400
|
-
path: "/webhooks/{webhook_endpoint_id}",
|
|
2401
|
-
pathParams: ["webhook_endpoint_id"],
|
|
2402
|
-
queryParams: [],
|
|
2403
|
-
bodyKind: "none",
|
|
2404
|
-
responseKind: "json",
|
|
2405
|
-
codes: 23
|
|
2406
|
-
},
|
|
2407
|
-
"webhooks.endpoints.getById": {
|
|
2408
|
-
method: "GET",
|
|
2409
|
-
path: "/webhooks/{webhook_endpoint_id}",
|
|
2410
|
-
pathParams: ["webhook_endpoint_id"],
|
|
2411
|
-
queryParams: [],
|
|
2412
|
-
bodyKind: "none",
|
|
2413
|
-
responseKind: "json",
|
|
2414
|
-
codes: 23
|
|
2415
|
-
},
|
|
2416
|
-
"webhooks.endpoints.list": {
|
|
2417
|
-
method: "GET",
|
|
2418
|
-
path: "/webhooks",
|
|
2419
|
-
pathParams: [],
|
|
2420
|
-
queryParams: ["search", "page", "limit", "sort_by", "sort_order"],
|
|
2421
|
-
bodyKind: "none",
|
|
2422
|
-
responseKind: "json",
|
|
2423
|
-
codes: 2
|
|
2424
|
-
},
|
|
2425
|
-
"webhooks.endpoints.rotateSecret": {
|
|
2426
|
-
method: "POST",
|
|
2427
|
-
path: "/webhooks/{webhook_endpoint_id}/rotate-secret",
|
|
2428
|
-
pathParams: ["webhook_endpoint_id"],
|
|
2429
|
-
queryParams: [],
|
|
2430
|
-
bodyKind: "none",
|
|
2431
|
-
responseKind: "json",
|
|
2432
|
-
codes: 23
|
|
2433
|
-
},
|
|
2434
|
-
"webhooks.endpoints.test": {
|
|
2435
|
-
method: "POST",
|
|
2436
|
-
path: "/webhooks/{webhook_endpoint_id}/test",
|
|
2437
|
-
pathParams: ["webhook_endpoint_id"],
|
|
2438
|
-
queryParams: [],
|
|
2439
|
-
bodyKind: "none",
|
|
2440
|
-
responseKind: "json",
|
|
2441
|
-
codes: 23
|
|
2442
|
-
},
|
|
2443
|
-
"webhooks.endpoints.update": {
|
|
2444
|
-
method: "PATCH",
|
|
2445
|
-
path: "/webhooks/{webhook_endpoint_id}",
|
|
2446
|
-
pathParams: ["webhook_endpoint_id"],
|
|
2447
|
-
queryParams: [],
|
|
2448
|
-
bodyKind: "json",
|
|
2449
|
-
responseKind: "json",
|
|
2450
|
-
codes: 23
|
|
2451
|
-
},
|
|
2452
|
-
"webhooks.events.list": {
|
|
2453
|
-
method: "GET",
|
|
2454
|
-
path: "/webhooks/events",
|
|
2455
|
-
pathParams: [],
|
|
2456
|
-
queryParams: [],
|
|
2457
|
-
bodyKind: "none",
|
|
2458
|
-
responseKind: "json",
|
|
2459
|
-
codes: 2
|
|
2460
|
-
}
|
|
2461
|
-
};
|
|
2462
|
-
|
|
2463
|
-
// src/transport.ts
|
|
2464
|
-
function splitOperationInput(op, input) {
|
|
2465
|
-
const record = isPlainObject(input) ? input : {};
|
|
2466
|
-
const path = {};
|
|
2467
|
-
const query = {};
|
|
2468
|
-
const body = {};
|
|
2469
|
-
const pathSet = new Set(op.pathParams);
|
|
2470
|
-
const querySet = new Set(op.queryParams);
|
|
2471
|
-
for (const [key, value] of Object.entries(record)) {
|
|
2472
|
-
if (pathSet.has(key)) {
|
|
2473
|
-
path[key] = encodeURIComponent(String(value));
|
|
2474
|
-
} else if (querySet.has(key)) {
|
|
2475
|
-
query[key] = value;
|
|
2476
|
-
} else if (op.bodyKind !== "none") {
|
|
2477
|
-
body[key] = value;
|
|
2478
|
-
}
|
|
2479
|
-
}
|
|
2480
|
-
return { path, query, body };
|
|
2481
|
-
}
|
|
2482
|
-
function isRecord2(value) {
|
|
2483
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
2484
|
-
}
|
|
2485
|
-
function isPlainObject(value) {
|
|
2486
|
-
if (!isRecord2(value))
|
|
2487
|
-
return false;
|
|
2488
|
-
const proto = Object.getPrototypeOf(value);
|
|
2489
|
-
return proto === Object.prototype || proto === null;
|
|
2490
|
-
}
|
|
2491
|
-
var SAFE_ERROR_NAMES = new Set([
|
|
2492
|
-
"TypeError",
|
|
2493
|
-
"AbortError",
|
|
2494
|
-
"TimeoutError",
|
|
2495
|
-
"DOMException",
|
|
2496
|
-
"Error",
|
|
2497
|
-
"SyntaxError"
|
|
2498
|
-
]);
|
|
2499
|
-
var SAFE_ERROR_CODES = new Set([
|
|
2500
|
-
"ECONNREFUSED",
|
|
2501
|
-
"ECONNRESET",
|
|
2502
|
-
"ENOTFOUND",
|
|
2503
|
-
"EAI_AGAIN",
|
|
2504
|
-
"ETIMEDOUT",
|
|
2505
|
-
"EHOSTUNREACH",
|
|
2506
|
-
"ENETUNREACH",
|
|
2507
|
-
"EPIPE",
|
|
2508
|
-
"CERT_HAS_EXPIRED",
|
|
2509
|
-
"DEPTH_ZERO_SELF_SIGNED_CERT",
|
|
2510
|
-
"UNABLE_TO_VERIFY_LEAF_SIGNATURE",
|
|
2511
|
-
"UND_ERR_CONNECT_TIMEOUT",
|
|
2512
|
-
"UND_ERR_HEADERS_TIMEOUT",
|
|
2513
|
-
"UND_ERR_BODY_TIMEOUT",
|
|
2514
|
-
"UND_ERR_SOCKET",
|
|
2515
|
-
"UND_ERR_ABORT",
|
|
2516
|
-
"UND_ERR_INFO",
|
|
2517
|
-
"UND_ERR_CLOSED",
|
|
2518
|
-
"UND_ERR_DESTROYED",
|
|
2519
|
-
"UND_ERR_REQ_CONTENT_LENGTH_MISMATCH",
|
|
2520
|
-
"UND_ERR_RES_CONTENT_LENGTH_MISMATCH",
|
|
2521
|
-
"UND_ERR_CONTINUE_100",
|
|
2522
|
-
"UND_ERR_HEADERS_OVERFLOW",
|
|
2523
|
-
"UND_ERR_BODY_TOO_LARGE",
|
|
2524
|
-
"UND_ERR_RESPONSE_STATUS_CODE",
|
|
2525
|
-
"UND_ERR_INVALID_ARG",
|
|
2526
|
-
"UND_ERR_NOT_SUPPORTED"
|
|
2527
|
-
]);
|
|
2528
|
-
function sanitizeCause(error) {
|
|
2529
|
-
if (!(error instanceof Error))
|
|
2530
|
-
return;
|
|
2531
|
-
const cause = {
|
|
2532
|
-
name: SAFE_ERROR_NAMES.has(error.name) ? error.name : "Error"
|
|
2533
|
-
};
|
|
2534
|
-
if (isRecord2(error)) {
|
|
2535
|
-
const code = error["code"];
|
|
2536
|
-
if (typeof code === "string" && SAFE_ERROR_CODES.has(code))
|
|
2537
|
-
cause.code = code;
|
|
2538
|
-
}
|
|
2539
|
-
return cause;
|
|
2540
|
-
}
|
|
2541
|
-
function jsonScalar(value) {
|
|
2542
|
-
if (value instanceof Date)
|
|
2543
|
-
return Number.isNaN(value.getTime()) ? null : value.toISOString();
|
|
2544
|
-
if (typeof value === "bigint" || value instanceof RegExp || value instanceof URL)
|
|
2545
|
-
return value.toString();
|
|
2546
|
-
if (typeof value === "number" && Number.isNaN(value))
|
|
2547
|
-
return null;
|
|
2548
|
-
return value;
|
|
2549
|
-
}
|
|
2550
|
-
function escapeSegment(segment) {
|
|
2551
|
-
const bs = String.fromCharCode(92);
|
|
2552
|
-
return segment.split(bs).join(bs + bs).split("[").join(bs + "[").split("]").join(bs + "]");
|
|
2553
|
-
}
|
|
2554
|
-
function bracketPath(segments) {
|
|
2555
|
-
return segments.map((segment) => typeof segment === "number" ? String(segment) : escapeSegment(segment)).reduce((head, segment, index) => index === 0 ? head + segment : `${head}[${segment}]`, "");
|
|
2556
|
-
}
|
|
2557
|
-
function flattenBracket(value, segments, out) {
|
|
2558
|
-
if (Array.isArray(value)) {
|
|
2559
|
-
value.forEach((item, index) => flattenBracket(item, [...segments, index], out));
|
|
2560
|
-
} else if (isPlainObject(value)) {
|
|
2561
|
-
for (const [key, entry] of Object.entries(value))
|
|
2562
|
-
flattenBracket(entry, [...segments, key], out);
|
|
2563
|
-
} else {
|
|
2564
|
-
out.push([bracketPath(segments), value]);
|
|
2565
|
-
}
|
|
2566
|
-
}
|
|
2567
|
-
function appendQueryValue(params, path, value) {
|
|
2568
|
-
const scalar = jsonScalar(value);
|
|
2569
|
-
if (typeof scalar === "string" || typeof scalar === "number" || typeof scalar === "boolean") {
|
|
2570
|
-
params.append(path, String(scalar));
|
|
2571
|
-
}
|
|
2572
|
-
}
|
|
2573
|
-
function encodeQueryParams(query) {
|
|
2574
|
-
const params = new URLSearchParams;
|
|
2575
|
-
const flat = [];
|
|
2576
|
-
flattenBracket(query, [], flat);
|
|
2577
|
-
for (const [path, value] of flat)
|
|
2578
|
-
appendQueryValue(params, path, value);
|
|
2579
|
-
return params.toString();
|
|
2580
|
-
}
|
|
2581
|
-
function encodeMultipartForm(body) {
|
|
2582
|
-
const form = new FormData;
|
|
2583
|
-
const flat = [];
|
|
2584
|
-
flattenBracket(body, [], flat);
|
|
2585
|
-
for (const [path, value] of flat) {
|
|
2586
|
-
const scalar = jsonScalar(value);
|
|
2587
|
-
if (typeof scalar === "string" || typeof scalar === "number" || typeof scalar === "boolean") {
|
|
2588
|
-
form.append(path, String(scalar));
|
|
2589
|
-
} else if (scalar instanceof Blob) {
|
|
2590
|
-
form.append(path, scalar);
|
|
2591
|
-
}
|
|
2592
|
-
}
|
|
2593
|
-
return form;
|
|
2594
|
-
}
|
|
2595
|
-
function encodeBody(bodyKind, body) {
|
|
2596
|
-
if (bodyKind === "multipart")
|
|
2597
|
-
return { contentType: undefined, body: encodeMultipartForm(body) };
|
|
2598
|
-
return { contentType: "application/json", body: JSON.stringify(body) };
|
|
2599
|
-
}
|
|
2600
|
-
function mergeRequestHeaders(base, extra) {
|
|
2601
|
-
const merged = new Headers(base);
|
|
2602
|
-
if (extra !== undefined)
|
|
2603
|
-
new Headers(extra).forEach((value, key) => merged.set(key, value));
|
|
2604
|
-
return merged;
|
|
2605
|
-
}
|
|
2606
|
-
function abortError(signal, timeoutMs) {
|
|
2607
|
-
if (signal?.aborted === true) {
|
|
2608
|
-
return new NivaConnectionError("request aborted by the caller", { reason: "aborted" });
|
|
2609
|
-
}
|
|
2610
|
-
return new NivaConnectionError(`request timed out after ${timeoutMs}ms`, { reason: "timeout" });
|
|
2611
|
-
}
|
|
2612
|
-
async function fetchWithTimeout(fetchImpl, url, init, timeoutMs) {
|
|
2613
|
-
const callerSignal = init.signal instanceof AbortSignal ? init.signal : undefined;
|
|
2614
|
-
if (callerSignal?.aborted === true)
|
|
2615
|
-
throw abortError(callerSignal, timeoutMs);
|
|
2616
|
-
const controller = new AbortController;
|
|
2617
|
-
const onCallerAbort = () => controller.abort();
|
|
2618
|
-
callerSignal?.addEventListener("abort", onCallerAbort, { once: true });
|
|
2619
|
-
const timer = setTimeout(() => {
|
|
2620
|
-
callerSignal?.removeEventListener("abort", onCallerAbort);
|
|
2621
|
-
controller.abort();
|
|
2622
|
-
}, timeoutMs);
|
|
2623
|
-
try {
|
|
2624
|
-
return await fetchImpl(url, { ...init, signal: controller.signal });
|
|
2625
|
-
} catch (error) {
|
|
2626
|
-
if (error instanceof Error && error.name === "AbortError")
|
|
2627
|
-
throw abortError(callerSignal, timeoutMs);
|
|
2628
|
-
throw new NivaConnectionError("request failed", { reason: "network", cause: sanitizeCause(error) });
|
|
2629
|
-
} finally {
|
|
2630
|
-
clearTimeout(timer);
|
|
2631
|
-
}
|
|
2632
|
-
}
|
|
2633
|
-
function isDefinedErrorBody(body) {
|
|
2634
|
-
if (!isPlainObject(body))
|
|
2635
|
-
return false;
|
|
2636
|
-
return body["defined"] === true && typeof body["code"] === "string" && typeof body["status"] === "number" && typeof body["message"] === "string";
|
|
2637
|
-
}
|
|
2638
|
-
async function parseApiError(response, operation) {
|
|
2639
|
-
const requestId = response.headers.get("x-request-id") ?? undefined;
|
|
2640
|
-
let body;
|
|
2641
|
-
try {
|
|
2642
|
-
body = await response.json();
|
|
2643
|
-
} catch {
|
|
2644
|
-
body = undefined;
|
|
2645
|
-
}
|
|
2646
|
-
if (isDefinedErrorBody(body)) {
|
|
2647
|
-
return new NivaApiError({
|
|
2648
|
-
status: body.status,
|
|
2649
|
-
code: body.code,
|
|
2650
|
-
message: body.message,
|
|
2651
|
-
data: body.data,
|
|
2652
|
-
requestId,
|
|
2653
|
-
operation
|
|
2654
|
-
});
|
|
2655
|
-
}
|
|
2656
|
-
return new NivaApiError({
|
|
2657
|
-
status: response.status,
|
|
2658
|
-
code: "UNEXPECTED_RESPONSE",
|
|
2659
|
-
message: `request failed with status ${response.status}`,
|
|
2660
|
-
requestId,
|
|
2661
|
-
operation
|
|
2662
|
-
});
|
|
2663
|
-
}
|
|
2664
|
-
async function readJsonResponse(response, operation = "unknown") {
|
|
2665
|
-
if (response.status === 204)
|
|
2666
|
-
return;
|
|
2667
|
-
try {
|
|
2668
|
-
return await response.json();
|
|
2669
|
-
} catch {
|
|
2670
|
-
throw new NivaApiError({
|
|
2671
|
-
status: response.status,
|
|
2672
|
-
code: "UNEXPECTED_RESPONSE",
|
|
2673
|
-
message: `request succeeded with a malformed JSON body (status ${response.status})`,
|
|
2674
|
-
operation
|
|
2675
|
-
});
|
|
2676
|
-
}
|
|
2677
|
-
}
|
|
2678
|
-
|
|
2679
|
-
// src/handshake.ts
|
|
2680
|
-
var PUBLISHED_PACKAGE = "@sippulse/niva-sdk";
|
|
2681
|
-
function isRecord3(value) {
|
|
2682
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
2683
|
-
}
|
|
2684
|
-
function parseVersion(value) {
|
|
2685
|
-
if (typeof value !== "string")
|
|
2686
|
-
return;
|
|
2687
|
-
const match = /^(\d+)\.(\d+)\.(\d+)(?:-([\w.-]+))?$/.exec(value);
|
|
2688
|
-
if (match === null)
|
|
2689
|
-
return;
|
|
2690
|
-
const [, major, minor, patch, pre] = match;
|
|
2691
|
-
return { major: Number(major), minor: Number(minor), patch: Number(patch), pre };
|
|
2692
|
-
}
|
|
2693
|
-
function isBelowFloor(version, floor) {
|
|
2694
|
-
if (version.major !== floor.major)
|
|
2695
|
-
return version.major < floor.major;
|
|
2696
|
-
if (version.minor !== floor.minor)
|
|
2697
|
-
return version.minor < floor.minor;
|
|
2698
|
-
if (version.patch !== floor.patch)
|
|
2699
|
-
return version.patch < floor.patch;
|
|
2700
|
-
if (version.pre === floor.pre)
|
|
2701
|
-
return false;
|
|
2702
|
-
if (version.pre === undefined)
|
|
2703
|
-
return false;
|
|
2704
|
-
return true;
|
|
2705
|
-
}
|
|
2706
|
-
function rowForServer(serverVersion) {
|
|
2707
|
-
for (const row of COMPAT_TABLE) {
|
|
2708
|
-
const min = parseVersion(row.nivaMin);
|
|
2709
|
-
if (min === undefined)
|
|
2710
|
-
continue;
|
|
2711
|
-
if (isBelowFloor(serverVersion, min))
|
|
2712
|
-
continue;
|
|
2713
|
-
if (row.nivaMax !== null) {
|
|
2714
|
-
const max = parseVersion(row.nivaMax);
|
|
2715
|
-
if (max === undefined || isBelowFloor(max, serverVersion))
|
|
2716
|
-
continue;
|
|
2717
|
-
}
|
|
2718
|
-
return { distTag: row.distTag };
|
|
2719
|
-
}
|
|
2720
|
-
return;
|
|
2721
|
-
}
|
|
2722
|
-
function incompatibleError(baseUrl, serverVersion, serverProtocol) {
|
|
2723
|
-
const range = SUPPORTED_NIVA.max === null ? `>= ${SUPPORTED_NIVA.min}` : `>= ${SUPPORTED_NIVA.min} <${SUPPORTED_NIVA.max}`;
|
|
2724
|
-
const lines = [
|
|
2725
|
-
`${PUBLISHED_PACKAGE}@${SDK_VERSION} requires NIVA ${range} (protocol ${PROTOCOL_VERSION}).`,
|
|
2726
|
-
`The server ${baseUrl} reports NIVA ${serverVersion} (protocol ${String(serverProtocol)}).`
|
|
2727
|
-
];
|
|
2728
|
-
let installCommand;
|
|
2729
|
-
const parsed = parseVersion(serverVersion);
|
|
2730
|
-
const row = parsed === undefined ? undefined : rowForServer(parsed);
|
|
2731
|
-
if (row !== undefined) {
|
|
2732
|
-
installCommand = `npm i ${PUBLISHED_PACKAGE}@${row.distTag}`;
|
|
2733
|
-
lines.push(`Install the matching version: ${installCommand}`);
|
|
2734
|
-
}
|
|
2735
|
-
return new NivaIncompatibleServerError(lines.join(`
|
|
2736
|
-
`), {
|
|
2737
|
-
serverVersion,
|
|
2738
|
-
supported: range,
|
|
2739
|
-
installCommand
|
|
2740
|
-
});
|
|
2741
|
-
}
|
|
2742
|
-
async function resolveHandshakeHeaders(input) {
|
|
2743
|
-
const base = typeof input.headers === "function" ? await input.headers() : input.headers;
|
|
2744
|
-
const headers = new Headers(base);
|
|
2745
|
-
if (!headers.has("accept"))
|
|
2746
|
-
headers.set("accept", "application/json");
|
|
2747
|
-
return headers;
|
|
2748
|
-
}
|
|
2749
|
-
async function readJson(response) {
|
|
2750
|
-
try {
|
|
2751
|
-
const parsed = await response.json();
|
|
2752
|
-
return parsed;
|
|
2753
|
-
} catch {
|
|
2754
|
-
return;
|
|
2755
|
-
}
|
|
2756
|
-
}
|
|
2757
|
-
async function fetchVersion(input) {
|
|
2758
|
-
const timeout = input.timeout ?? 30000;
|
|
2759
|
-
let response;
|
|
2760
|
-
try {
|
|
2761
|
-
response = await fetchWithTimeout(input.fetchImpl, `${input.baseUrl}/api/version`, { headers: { accept: "application/json" } }, timeout);
|
|
2762
|
-
} catch (error) {
|
|
2763
|
-
if (error instanceof NivaConnectionError)
|
|
2764
|
-
throw error;
|
|
2765
|
-
throw new NivaConnectionError("version check failed", {
|
|
2766
|
-
reason: "network",
|
|
2767
|
-
cause: error instanceof Error ? error : undefined
|
|
2768
|
-
});
|
|
2769
|
-
}
|
|
2770
|
-
const body = await readJson(response);
|
|
2771
|
-
if (!isRecord3(body)) {
|
|
2772
|
-
throw new NivaConnectionError("unexpected version response: not JSON", { reason: "network" });
|
|
2773
|
-
}
|
|
2774
|
-
const record = body;
|
|
2775
|
-
const nivaVersion = record["niva_version"];
|
|
2776
|
-
if (typeof nivaVersion !== "string" || parseVersion(nivaVersion) === undefined) {
|
|
2777
|
-
throw new NivaConnectionError("unexpected version response: bad niva_version", { reason: "network" });
|
|
2778
|
-
}
|
|
2779
|
-
return { nivaVersion, protocol: record["protocol_version"] };
|
|
2780
|
-
}
|
|
2781
|
-
var EMPTY_SNAPSHOT = { operations: undefined, modules: {}, requiredModules: {} };
|
|
2782
|
-
async function fetchCapabilities(input) {
|
|
2783
|
-
const timeout = input.timeout ?? 30000;
|
|
2784
|
-
const response = await fetchWithTimeout(input.fetchImpl, `${input.baseUrl}/api/v1/capabilities`, { headers: await resolveHandshakeHeaders(input) }, timeout);
|
|
2785
|
-
if (response.status === 404 || response.status === 403)
|
|
2786
|
-
return { ...EMPTY_SNAPSHOT };
|
|
2787
|
-
if (response.status < 200 || response.status >= 300)
|
|
2788
|
-
throw await parseApiError(response, "capabilities.get");
|
|
2789
|
-
const raw = await readJson(response);
|
|
2790
|
-
if (!isRecord3(raw))
|
|
2791
|
-
return { ...EMPTY_SNAPSHOT };
|
|
2792
|
-
return parseSnapshot(raw);
|
|
2793
|
-
}
|
|
2794
|
-
function parseSnapshot(body) {
|
|
2795
|
-
const modules = {};
|
|
2796
|
-
const modulesValue = body["modules"];
|
|
2797
|
-
if (isRecord3(modulesValue)) {
|
|
2798
|
-
for (const [key, value] of Object.entries(modulesValue)) {
|
|
2799
|
-
if (typeof value === "boolean")
|
|
2800
|
-
modules[key] = value;
|
|
2801
|
-
}
|
|
2802
|
-
}
|
|
2803
|
-
const requiredModules = {};
|
|
2804
|
-
const requiredValue = body["required_modules"];
|
|
2805
|
-
if (isRecord3(requiredValue)) {
|
|
2806
|
-
for (const [key, value] of Object.entries(requiredValue)) {
|
|
2807
|
-
if (Array.isArray(value)) {
|
|
2808
|
-
requiredModules[key] = value.filter((entry) => typeof entry === "string");
|
|
2809
|
-
}
|
|
2810
|
-
}
|
|
2811
|
-
}
|
|
2812
|
-
const operations = body["operations"];
|
|
2813
|
-
return {
|
|
2814
|
-
operations: Array.isArray(operations) ? operations.filter((op) => typeof op === "string") : [],
|
|
2815
|
-
modules,
|
|
2816
|
-
requiredModules
|
|
2817
|
-
};
|
|
2818
|
-
}
|
|
2819
|
-
function createHandshake(input) {
|
|
2820
|
-
let memo;
|
|
2821
|
-
return {
|
|
2822
|
-
async ensure() {
|
|
2823
|
-
memo ??= run().catch((error) => {
|
|
2824
|
-
if (error instanceof NivaConnectionError)
|
|
2825
|
-
memo = undefined;
|
|
2826
|
-
throw error;
|
|
2827
|
-
});
|
|
2828
|
-
return memo;
|
|
2829
|
-
}
|
|
2830
|
-
};
|
|
2831
|
-
async function run() {
|
|
2832
|
-
const { nivaVersion, protocol } = await fetchVersion(input);
|
|
2833
|
-
const floor = parseVersion(SUPPORTED_NIVA.min);
|
|
2834
|
-
const parsed = parseVersion(nivaVersion);
|
|
2835
|
-
if (floor === undefined || parsed === undefined || isBelowFloor(parsed, floor) || protocol !== PROTOCOL_VERSION) {
|
|
2836
|
-
throw incompatibleError(input.baseUrl, nivaVersion, protocol);
|
|
2837
|
-
}
|
|
2838
|
-
return fetchCapabilities(input);
|
|
2839
|
-
}
|
|
2840
|
-
}
|
|
2841
|
-
function assertOperationAvailable(snapshot, opId) {
|
|
2842
|
-
if (snapshot.operations === undefined)
|
|
2843
|
-
return;
|
|
2844
|
-
if (!snapshot.operations.includes(opId))
|
|
2845
|
-
throw new NivaUnavailableError(opId, { reason: "operation" });
|
|
2846
|
-
const required = snapshot.requiredModules[opId];
|
|
2847
|
-
if (required === undefined)
|
|
2848
|
-
return;
|
|
2849
|
-
const disabled = required.find((module) => snapshot.modules[module] !== true);
|
|
2850
|
-
if (disabled !== undefined)
|
|
2851
|
-
throw new NivaUnavailableError(opId, { reason: "module", module: disabled });
|
|
2852
|
-
}
|
|
2853
|
-
|
|
2854
|
-
// src/safe.ts
|
|
2855
|
-
var DECLARED_CODES = new WeakMap;
|
|
2856
|
-
var ERROR_CODE_INDEX = new Map(ERROR_CODES.map((code, index) => [code, index]));
|
|
2857
|
-
var COMMON_CODES = new Set(COMMON_ERROR_CODES);
|
|
2858
|
-
function attachDeclaredCodes(error, setIndex) {
|
|
2859
|
-
DECLARED_CODES.set(error, setIndex);
|
|
2860
|
-
}
|
|
2861
|
-
function isDeclared(error) {
|
|
2862
|
-
if (!(error instanceof NivaApiError))
|
|
2863
|
-
return false;
|
|
2864
|
-
const apiError = error;
|
|
2865
|
-
const setIndex = DECLARED_CODES.get(apiError);
|
|
2866
|
-
if (setIndex === undefined)
|
|
2867
|
-
return false;
|
|
2868
|
-
const index = ERROR_CODE_INDEX.get(apiError.code);
|
|
2869
|
-
if (index === undefined)
|
|
2870
|
-
return false;
|
|
2871
|
-
const set = ERROR_CODE_SETS[setIndex];
|
|
2872
|
-
return COMMON_CODES.has(index) || (set?.includes(index) ?? false);
|
|
2873
|
-
}
|
|
2874
|
-
function classify(thrown) {
|
|
2875
|
-
try {
|
|
2876
|
-
if (thrown instanceof NivaError) {
|
|
2877
|
-
return { error: thrown, defined: isDeclared(thrown) };
|
|
2878
|
-
}
|
|
2879
|
-
} catch {}
|
|
2880
|
-
return { error: new NivaConfigurationError("client call failed"), defined: false };
|
|
2881
|
-
}
|
|
2882
|
-
function makeResult(error, data, isDefined, isSuccess) {
|
|
2883
|
-
const tuple = [error, data, isDefined, isSuccess];
|
|
2884
|
-
return Object.assign(tuple, { error, data, isDefined, isSuccess });
|
|
2885
|
-
}
|
|
2886
|
-
async function safe(call) {
|
|
2887
|
-
try {
|
|
2888
|
-
return makeResult(null, await call, false, true);
|
|
2889
|
-
} catch (error) {
|
|
2890
|
-
const { error: caught, defined } = classify(error);
|
|
2891
|
-
if (defined) {
|
|
2892
|
-
const declaredError = caught;
|
|
2893
|
-
return makeResult(declaredError, undefined, true, false);
|
|
2894
|
-
}
|
|
2895
|
-
return makeResult(caught, undefined, false, false);
|
|
2896
|
-
}
|
|
2897
|
-
}
|
|
2898
|
-
|
|
2899
|
-
// src/client.ts
|
|
2900
|
-
var DEFAULT_TIMEOUT_MS = 30000;
|
|
2901
|
-
function normalizeBaseUrl(baseUrl) {
|
|
2902
|
-
let url;
|
|
2903
|
-
try {
|
|
2904
|
-
url = new URL(baseUrl);
|
|
2905
|
-
} catch {
|
|
2906
|
-
throw new NivaConfigurationError(`baseUrl is not a URL: ${baseUrl}`);
|
|
2907
|
-
}
|
|
2908
|
-
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
2909
|
-
throw new NivaConfigurationError(`baseUrl must be http(s): ${baseUrl}`);
|
|
2910
|
-
}
|
|
2911
|
-
return url.toString().replace(/\/$/, "");
|
|
2912
|
-
}
|
|
2913
|
-
async function resolveHeaders(headers) {
|
|
2914
|
-
if (headers === undefined)
|
|
2915
|
-
return;
|
|
2916
|
-
try {
|
|
2917
|
-
return typeof headers === "function" ? await headers() : headers;
|
|
2918
|
-
} catch {
|
|
2919
|
-
throw new NivaConfigurationError("headers provider failed");
|
|
2920
|
-
}
|
|
2921
|
-
}
|
|
2922
|
-
function lookupOperation(opId) {
|
|
2923
|
-
for (const [id, entry] of Object.entries(OPERATIONS)) {
|
|
2924
|
-
if (id === opId)
|
|
2925
|
-
return entry;
|
|
2926
|
-
}
|
|
2927
|
-
throw new NivaUnavailableError(opId, { reason: "operation" });
|
|
2928
|
-
}
|
|
2929
|
-
async function resolveApiKey(apiKey) {
|
|
2930
|
-
let key;
|
|
2931
|
-
try {
|
|
2932
|
-
key = typeof apiKey === "function" ? await apiKey() : apiKey;
|
|
2933
|
-
} catch {
|
|
2934
|
-
throw new NivaConfigurationError("apiKey provider failed");
|
|
2935
|
-
}
|
|
2936
|
-
if (typeof key !== "string" || key.length === 0) {
|
|
2937
|
-
throw new NivaConfigurationError("apiKey provider resolved an empty key");
|
|
2938
|
-
}
|
|
2939
|
-
return key;
|
|
2940
|
-
}
|
|
2941
|
-
function buildUrl(baseUrl, entry, input) {
|
|
2942
|
-
const split = splitOperationInput(entry, input);
|
|
2943
|
-
let url = `${baseUrl}/api/v1${entry.path}`;
|
|
2944
|
-
for (const [name, encoded] of Object.entries(split.path)) {
|
|
2945
|
-
url = url.replace(`{${name}}`, encoded);
|
|
2946
|
-
}
|
|
2947
|
-
const query = encodeQueryParams(split.query);
|
|
2948
|
-
if (query.length > 0)
|
|
2949
|
-
url += `?${query}`;
|
|
2950
|
-
return url;
|
|
2951
|
-
}
|
|
2952
|
-
async function buildHeaders(deps, apiKey, callOptions, entry) {
|
|
2953
|
-
const headers = mergeRequestHeaders(await resolveHeaders(deps.clientHeaders), callOptions.headers);
|
|
2954
|
-
headers.set("x-api-key", apiKey);
|
|
2955
|
-
headers.set("x-niva-sdk-version", SDK_VERSION);
|
|
2956
|
-
if (!headers.has("accept"))
|
|
2957
|
-
headers.set("accept", "application/json");
|
|
2958
|
-
if (callOptions.range !== undefined && entry.responseKind === "binary")
|
|
2959
|
-
headers.set("range", callOptions.range);
|
|
2960
|
-
return headers;
|
|
2961
|
-
}
|
|
2962
|
-
function buildBody(entry, input) {
|
|
2963
|
-
const split = splitOperationInput(entry, input);
|
|
2964
|
-
if (entry.bodyKind === "none" || Object.keys(split.body).length === 0) {
|
|
2965
|
-
return { contentType: undefined, body: undefined };
|
|
2966
|
-
}
|
|
2967
|
-
const encoded = encodeBody(entry.bodyKind, split.body);
|
|
2968
|
-
return { contentType: encoded.contentType, body: encoded.body ?? undefined };
|
|
2969
|
-
}
|
|
2970
|
-
async function performRequest(deps, opId, entry, input, callOptions, apiKey) {
|
|
2971
|
-
const url = buildUrl(deps.baseUrl, entry, input);
|
|
2972
|
-
const headers = await buildHeaders(deps, apiKey, callOptions, entry);
|
|
2973
|
-
const { contentType, body } = buildBody(entry, input);
|
|
2974
|
-
if (contentType !== undefined)
|
|
2975
|
-
headers.set("content-type", contentType);
|
|
2976
|
-
const init = { method: entry.method, headers };
|
|
2977
|
-
if (body !== undefined)
|
|
2978
|
-
init.body = body;
|
|
2979
|
-
if (callOptions.signal !== undefined)
|
|
2980
|
-
init.signal = callOptions.signal;
|
|
2981
|
-
const timeout = callOptions.timeout ?? deps.defaultTimeout;
|
|
2982
|
-
const response = await fetchWithTimeout(deps.fetchImpl, url, init, timeout);
|
|
2983
|
-
if (response.status < 200 || response.status >= 300)
|
|
2984
|
-
throw await parseApiError(response, opId);
|
|
2985
|
-
if (entry.responseKind === "binary" || entry.responseKind === "sse")
|
|
2986
|
-
return response;
|
|
2987
|
-
if (entry.responseKind === "empty")
|
|
2988
|
-
return;
|
|
2989
|
-
return readJsonResponse(response, opId);
|
|
2990
|
-
}
|
|
2991
|
-
function asNivaError(error) {
|
|
2992
|
-
try {
|
|
2993
|
-
if (error instanceof NivaError)
|
|
2994
|
-
return error;
|
|
2995
|
-
} catch {}
|
|
2996
|
-
return new NivaConfigurationError("client call failed before a NIVA error could be produced");
|
|
2997
|
-
}
|
|
2998
|
-
function createNivaClient(options) {
|
|
2999
|
-
const baseUrl = normalizeBaseUrl(options.baseUrl);
|
|
3000
|
-
if (typeof options.apiKey === "string" && options.apiKey.length === 0) {
|
|
3001
|
-
throw new NivaConfigurationError("apiKey must not be empty");
|
|
3002
|
-
}
|
|
3003
|
-
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
3004
|
-
if (typeof fetchImpl !== "function")
|
|
3005
|
-
throw new NivaConfigurationError("no fetch implementation available");
|
|
3006
|
-
const defaultTimeout = options.timeout ?? DEFAULT_TIMEOUT_MS;
|
|
3007
|
-
const deps = {
|
|
3008
|
-
fetchImpl,
|
|
3009
|
-
baseUrl,
|
|
3010
|
-
defaultTimeout,
|
|
3011
|
-
handshake: createHandshake({
|
|
3012
|
-
fetchImpl,
|
|
3013
|
-
baseUrl,
|
|
3014
|
-
headers: async () => {
|
|
3015
|
-
const apiKey = await resolveApiKey(options.apiKey);
|
|
3016
|
-
const headers = mergeRequestHeaders(await resolveHeaders(options.headers));
|
|
3017
|
-
if (apiKey.length > 0)
|
|
3018
|
-
headers.set("x-api-key", apiKey);
|
|
3019
|
-
headers.set("x-niva-sdk-version", SDK_VERSION);
|
|
3020
|
-
return headers;
|
|
3021
|
-
},
|
|
3022
|
-
timeout: defaultTimeout
|
|
3023
|
-
}),
|
|
3024
|
-
apiKey: options.apiKey,
|
|
3025
|
-
clientHeaders: options.headers
|
|
3026
|
-
};
|
|
3027
|
-
function call(opId, input, callOptions) {
|
|
3028
|
-
const pending = (async () => {
|
|
3029
|
-
const entry = lookupOperation(opId);
|
|
3030
|
-
try {
|
|
3031
|
-
const snapshot = await deps.handshake.ensure();
|
|
3032
|
-
assertOperationAvailable(snapshot, opId);
|
|
3033
|
-
const apiKey = await resolveApiKey(deps.apiKey);
|
|
3034
|
-
return await performRequest(deps, opId, entry, input, callOptions ?? {}, apiKey);
|
|
3035
|
-
} catch (error) {
|
|
3036
|
-
if (error instanceof NivaApiError) {
|
|
3037
|
-
const apiError = error;
|
|
3038
|
-
attachDeclaredCodes(apiError, entry.codes);
|
|
3039
|
-
}
|
|
3040
|
-
throw asNivaError(error);
|
|
3041
|
-
}
|
|
3042
|
-
})();
|
|
3043
|
-
return pending;
|
|
3044
|
-
}
|
|
3045
|
-
return buildNivaClient(call);
|
|
3046
|
-
}
|
|
3047
|
-
// src/generated/webhooks.ts
|
|
3048
|
-
var NIVA_WEBHOOK_EVENT_TYPES = [
|
|
3049
|
-
"alert.fired",
|
|
3050
|
-
"alert.resolved",
|
|
3051
|
-
"call.amd_completed",
|
|
3052
|
-
"call.analysis_completed",
|
|
3053
|
-
"call.answered",
|
|
3054
|
-
"call.hangup",
|
|
3055
|
-
"call.intent_matched",
|
|
3056
|
-
"call.node_entered",
|
|
3057
|
-
"call.node_error",
|
|
3058
|
-
"call.node_warning",
|
|
3059
|
-
"call.recording_available",
|
|
3060
|
-
"call.rejected",
|
|
3061
|
-
"call.signal_triggered",
|
|
3062
|
-
"call.started",
|
|
3063
|
-
"call.transcribed",
|
|
3064
|
-
"call.transcription_failed",
|
|
3065
|
-
"call.transferred",
|
|
3066
|
-
"dialer.attempt.finished",
|
|
3067
|
-
"message.sent",
|
|
3068
|
-
"plan.published",
|
|
3069
|
-
"service.down",
|
|
3070
|
-
"service.up",
|
|
3071
|
-
"webhook.test"
|
|
3072
|
-
];
|
|
3073
|
-
// src/webhook/verify.ts
|
|
3074
|
-
var SIGNATURE_RE = /^sha256=([0-9a-f]{64})$/;
|
|
3075
|
-
var TIMESTAMP_RE = /^(0|[1-9]\d{0,15})$/;
|
|
3076
|
-
var ISO_DATETIME_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,3})?Z$/;
|
|
3077
|
-
var DEFAULT_TOLERANCE_SECONDS = 300;
|
|
3078
|
-
function readHeader(headers, name) {
|
|
3079
|
-
if (headers instanceof Headers) {
|
|
3080
|
-
const value2 = headers.get(name);
|
|
3081
|
-
return value2 !== null && value2.length > 0 ? value2 : undefined;
|
|
3082
|
-
}
|
|
3083
|
-
const matches = Object.entries(headers).filter(([key]) => key.toLowerCase() === name);
|
|
3084
|
-
if (matches.length > 1)
|
|
3085
|
-
throw verification("duplicate_header", `duplicate ${name}`);
|
|
3086
|
-
const value = matches[0]?.[1];
|
|
3087
|
-
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
3088
|
-
}
|
|
3089
|
-
var verification = (code, message) => new NivaWebhookError("verification", code, message);
|
|
3090
|
-
var payload = (code, message) => new NivaWebhookError("payload", code, message);
|
|
3091
|
-
function isJsonObject(value) {
|
|
3092
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3093
|
-
}
|
|
3094
|
-
function hasControlChars(value) {
|
|
3095
|
-
for (let i = 0;i < value.length; i++) {
|
|
3096
|
-
const code = value.charCodeAt(i);
|
|
3097
|
-
if (code <= 31 || code === 127)
|
|
3098
|
-
return true;
|
|
3099
|
-
}
|
|
3100
|
-
return false;
|
|
3101
|
-
}
|
|
3102
|
-
function readDeliveryHeaders(headers) {
|
|
3103
|
-
const id = readHeader(headers, "x-webhook-id");
|
|
3104
|
-
const timestampText = readHeader(headers, "x-webhook-timestamp");
|
|
3105
|
-
const signature = readHeader(headers, "x-webhook-signature");
|
|
3106
|
-
if (id === undefined)
|
|
3107
|
-
throw verification("missing_header", "missing x-webhook-id");
|
|
3108
|
-
if (timestampText === undefined)
|
|
3109
|
-
throw verification("missing_header", "missing x-webhook-timestamp");
|
|
3110
|
-
if (signature === undefined)
|
|
3111
|
-
throw verification("missing_header", "missing x-webhook-signature");
|
|
3112
|
-
return { id, timestampText, signature };
|
|
3113
|
-
}
|
|
3114
|
-
function checkTimestamp(timestampText, toleranceSeconds, nowSeconds) {
|
|
3115
|
-
if (!TIMESTAMP_RE.test(timestampText))
|
|
3116
|
-
throw verification("bad_timestamp", "malformed x-webhook-timestamp");
|
|
3117
|
-
const timestamp = Number(timestampText);
|
|
3118
|
-
if (!Number.isSafeInteger(timestamp) || Math.abs(nowSeconds - timestamp) > toleranceSeconds) {
|
|
3119
|
-
throw verification("timestamp_out_of_tolerance", "webhook timestamp outside the allowed window");
|
|
3120
|
-
}
|
|
3121
|
-
}
|
|
3122
|
-
function freshBytes(length) {
|
|
3123
|
-
return new Uint8Array(new ArrayBuffer(length));
|
|
3124
|
-
}
|
|
3125
|
-
function hexToBytes(hex) {
|
|
3126
|
-
const out = freshBytes(hex.length / 2);
|
|
3127
|
-
for (let i = 0;i < out.length; i++)
|
|
3128
|
-
out[i] = Number.parseInt(hex.slice(i * 2, i * 2 + 2), 16);
|
|
3129
|
-
return out;
|
|
3130
|
-
}
|
|
3131
|
-
function bodyBytes(body) {
|
|
3132
|
-
if (typeof body === "string")
|
|
3133
|
-
return new TextEncoder().encode(body);
|
|
3134
|
-
if (body instanceof Uint8Array)
|
|
3135
|
-
return body;
|
|
3136
|
-
return new Uint8Array(body);
|
|
3137
|
-
}
|
|
3138
|
-
async function verifySignature(secret, id, timestampText, raw, signature) {
|
|
3139
|
-
const signatureMatch = SIGNATURE_RE.exec(signature);
|
|
3140
|
-
if (signatureMatch === null)
|
|
3141
|
-
throw verification("bad_signature", "malformed x-webhook-signature");
|
|
3142
|
-
const encoder = new TextEncoder;
|
|
3143
|
-
const secretBytes = encoder.encode(secret);
|
|
3144
|
-
const keyMaterial = freshBytes(secretBytes.length);
|
|
3145
|
-
keyMaterial.set(secretBytes);
|
|
3146
|
-
const key = await crypto.subtle.importKey("raw", keyMaterial, { name: "HMAC", hash: "SHA-256" }, false, ["verify"]);
|
|
3147
|
-
const prefix = encoder.encode(`${id}.${timestampText}.`);
|
|
3148
|
-
const signed = freshBytes(prefix.length + raw.length);
|
|
3149
|
-
signed.set(prefix, 0);
|
|
3150
|
-
signed.set(raw, prefix.length);
|
|
3151
|
-
let valid = false;
|
|
3152
|
-
try {
|
|
3153
|
-
valid = await crypto.subtle.verify("HMAC", key, hexToBytes(signatureMatch[1]), signed);
|
|
3154
|
-
} catch {
|
|
3155
|
-
valid = false;
|
|
3156
|
-
}
|
|
3157
|
-
if (!valid)
|
|
3158
|
-
throw verification("bad_signature", "webhook signature mismatch");
|
|
3159
|
-
}
|
|
3160
|
-
function parseEnvelope(raw, headerId) {
|
|
3161
|
-
let parsed;
|
|
3162
|
-
try {
|
|
3163
|
-
parsed = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(raw));
|
|
3164
|
-
} catch {
|
|
3165
|
-
throw payload("invalid_json", "webhook body is not valid JSON");
|
|
3166
|
-
}
|
|
3167
|
-
if (!isJsonObject(parsed)) {
|
|
3168
|
-
throw payload("invalid_envelope", "webhook body is not an envelope object");
|
|
3169
|
-
}
|
|
3170
|
-
const body = parsed;
|
|
3171
|
-
if ("org_id" in body)
|
|
3172
|
-
throw payload("invalid_envelope", "webhook envelope carries org_id");
|
|
3173
|
-
if (typeof body["event"] !== "string")
|
|
3174
|
-
throw payload("invalid_envelope", "webhook envelope has no event");
|
|
3175
|
-
const event = NIVA_WEBHOOK_EVENT_TYPES.find((candidate) => candidate === body["event"]);
|
|
3176
|
-
if (event === undefined)
|
|
3177
|
-
throw payload("unknown_event", "unknown webhook event");
|
|
3178
|
-
if (typeof body["event_id"] !== "string" || body["event_id"].length === 0) {
|
|
3179
|
-
throw payload("invalid_envelope", "webhook envelope has no event_id");
|
|
3180
|
-
}
|
|
3181
|
-
if (typeof body["timestamp"] !== "string" || !isDispatcherTimestamp(body["timestamp"])) {
|
|
3182
|
-
throw payload("invalid_envelope", "webhook envelope timestamp is not an ISO 8601 date-time");
|
|
3183
|
-
}
|
|
3184
|
-
if (typeof body["data"] !== "object" || body["data"] === null || Array.isArray(body["data"])) {
|
|
3185
|
-
throw payload("invalid_envelope", "webhook envelope has no data object");
|
|
3186
|
-
}
|
|
3187
|
-
if (body["event_id"] !== headerId)
|
|
3188
|
-
throw payload("invalid_envelope", "webhook id does not match the envelope");
|
|
3189
|
-
return { event, event_id: body["event_id"], timestamp: body["timestamp"], data: body["data"] };
|
|
3190
|
-
}
|
|
3191
|
-
async function verifyNivaWebhook(options) {
|
|
3192
|
-
const { secret, toleranceSeconds = DEFAULT_TOLERANCE_SECONDS } = options;
|
|
3193
|
-
if (secret.length === 0)
|
|
3194
|
-
throw verification("bad_signature", "a non-empty webhook secret is required");
|
|
3195
|
-
const { id, timestampText, signature } = readDeliveryHeaders(options.headers);
|
|
3196
|
-
if (id.length > 256 || hasControlChars(id))
|
|
3197
|
-
throw verification("bad_signature", "malformed x-webhook-id");
|
|
3198
|
-
checkTimestamp(timestampText, toleranceSeconds, options.now ?? Math.floor(Date.now() / 1000));
|
|
3199
|
-
const raw = bodyBytes(options.body);
|
|
3200
|
-
await verifySignature(secret, id, timestampText, raw, signature);
|
|
3201
|
-
return envelopeToEvent(parseEnvelope(raw, id));
|
|
3202
|
-
}
|
|
3203
|
-
function isDispatcherTimestamp(value) {
|
|
3204
|
-
return ISO_DATETIME_RE.test(value) && Number.isFinite(Date.parse(value));
|
|
3205
|
-
}
|
|
3206
|
-
function envelopeToEvent(envelope) {
|
|
3207
|
-
return envelope;
|
|
3208
|
-
}
|
|
3209
|
-
// src/webhook/handler.ts
|
|
3210
|
-
var DEFAULT_MAX_BODY_BYTES = 1024 * 1024;
|
|
3211
|
-
var DRAIN_CAP_BYTES = 1024 * 1024;
|
|
3212
|
-
var DRAIN_TIMEOUT_MS = 1000;
|
|
3213
|
-
function concatChunks(chunks, total) {
|
|
3214
|
-
const out = new Uint8Array(total);
|
|
3215
|
-
let offset = 0;
|
|
3216
|
-
for (const chunk of chunks) {
|
|
3217
|
-
out.set(chunk, offset);
|
|
3218
|
-
offset += chunk.byteLength;
|
|
3219
|
-
}
|
|
3220
|
-
return out;
|
|
3221
|
-
}
|
|
3222
|
-
async function drainOverLimit(reader) {
|
|
3223
|
-
const deadline = Date.now() + DRAIN_TIMEOUT_MS;
|
|
3224
|
-
let discarded = 0;
|
|
3225
|
-
for (;; ) {
|
|
3226
|
-
const remaining = deadline - Date.now();
|
|
3227
|
-
if (remaining <= 0)
|
|
3228
|
-
return;
|
|
3229
|
-
let timer;
|
|
3230
|
-
try {
|
|
3231
|
-
const next = await Promise.race([
|
|
3232
|
-
reader.read(),
|
|
3233
|
-
new Promise((resolve) => {
|
|
3234
|
-
timer = setTimeout(() => resolve(undefined), remaining);
|
|
3235
|
-
})
|
|
3236
|
-
]);
|
|
3237
|
-
if (next === undefined || next.done)
|
|
3238
|
-
return;
|
|
3239
|
-
discarded += next.value.byteLength;
|
|
3240
|
-
if (discarded > DRAIN_CAP_BYTES)
|
|
3241
|
-
return;
|
|
3242
|
-
} finally {
|
|
3243
|
-
if (timer !== undefined)
|
|
3244
|
-
clearTimeout(timer);
|
|
3245
|
-
}
|
|
3246
|
-
}
|
|
3247
|
-
}
|
|
3248
|
-
|
|
3249
|
-
class BodyTooLargeError extends Error {
|
|
3250
|
-
constructor() {
|
|
3251
|
-
super("webhook body exceeds maxBodyBytes");
|
|
3252
|
-
this.name = "BodyTooLargeError";
|
|
3253
|
-
}
|
|
3254
|
-
}
|
|
3255
|
-
async function readBodyWithLimit(request, maxBodyBytes) {
|
|
3256
|
-
if (request.body === null)
|
|
3257
|
-
return new Uint8Array(0);
|
|
3258
|
-
const reader = request.body.getReader();
|
|
3259
|
-
const chunks = [];
|
|
3260
|
-
let total = 0;
|
|
3261
|
-
try {
|
|
3262
|
-
for (;; ) {
|
|
3263
|
-
const { done, value } = await reader.read();
|
|
3264
|
-
if (done)
|
|
3265
|
-
return concatChunks(chunks, total);
|
|
3266
|
-
total += value.byteLength;
|
|
3267
|
-
if (total <= maxBodyBytes) {
|
|
3268
|
-
chunks.push(value);
|
|
3269
|
-
continue;
|
|
3270
|
-
}
|
|
3271
|
-
chunks.length = 0;
|
|
3272
|
-
await drainOverLimit(reader);
|
|
3273
|
-
try {
|
|
3274
|
-
await reader.cancel();
|
|
3275
|
-
} catch {}
|
|
3276
|
-
throw new BodyTooLargeError;
|
|
3277
|
-
}
|
|
3278
|
-
} finally {
|
|
3279
|
-
reader.releaseLock();
|
|
3280
|
-
}
|
|
3281
|
-
}
|
|
3282
|
-
var empty = (status, headers) => new Response(null, headers === undefined ? { status } : { status, headers });
|
|
3283
|
-
function createNivaWebhookHandler(options) {
|
|
3284
|
-
const path = options.path ?? "/";
|
|
3285
|
-
const maxBodyBytes = options.maxBodyBytes ?? DEFAULT_MAX_BODY_BYTES;
|
|
3286
|
-
const handlers = new Map;
|
|
3287
|
-
return {
|
|
3288
|
-
on(event, handler) {
|
|
3289
|
-
if (handlers.has(event))
|
|
3290
|
-
throw new Error(`a handler is already registered for event ${JSON.stringify(event)}`);
|
|
3291
|
-
handlers.set(event, async (incoming, context) => {
|
|
3292
|
-
if (incoming.event !== event)
|
|
3293
|
-
throw new Error("webhook dispatcher delivered the wrong event");
|
|
3294
|
-
await handler(incoming, context);
|
|
3295
|
-
});
|
|
3296
|
-
},
|
|
3297
|
-
off(event) {
|
|
3298
|
-
handlers.delete(event);
|
|
3299
|
-
},
|
|
3300
|
-
async fetch(request) {
|
|
3301
|
-
let pathname;
|
|
3302
|
-
try {
|
|
3303
|
-
pathname = new URL(request.url).pathname;
|
|
3304
|
-
} catch {
|
|
3305
|
-
return empty(400);
|
|
3306
|
-
}
|
|
3307
|
-
if (pathname !== path)
|
|
3308
|
-
return empty(404);
|
|
3309
|
-
if (request.method !== "POST")
|
|
3310
|
-
return empty(405);
|
|
3311
|
-
let raw;
|
|
3312
|
-
try {
|
|
3313
|
-
raw = await readBodyWithLimit(request, maxBodyBytes);
|
|
3314
|
-
} catch (error) {
|
|
3315
|
-
if (error instanceof BodyTooLargeError)
|
|
3316
|
-
return empty(413, { Connection: "close" });
|
|
3317
|
-
return empty(500);
|
|
3318
|
-
}
|
|
3319
|
-
let event;
|
|
3320
|
-
try {
|
|
3321
|
-
event = await verifyNivaWebhook({
|
|
3322
|
-
secret: options.secret,
|
|
3323
|
-
headers: request.headers,
|
|
3324
|
-
body: raw,
|
|
3325
|
-
...options.toleranceSeconds === undefined ? {} : { toleranceSeconds: options.toleranceSeconds }
|
|
3326
|
-
});
|
|
3327
|
-
} catch (error) {
|
|
3328
|
-
if (error instanceof NivaWebhookError)
|
|
3329
|
-
return empty(error.kind === "verification" ? 401 : 400);
|
|
3330
|
-
return empty(500);
|
|
3331
|
-
}
|
|
3332
|
-
const handler = handlers.get(event.event);
|
|
3333
|
-
if (handler === undefined)
|
|
3334
|
-
return empty(422);
|
|
3335
|
-
try {
|
|
3336
|
-
await handler(event, { signal: request.signal });
|
|
3337
|
-
} catch {
|
|
3338
|
-
return empty(500);
|
|
3339
|
-
}
|
|
3340
|
-
return empty(204);
|
|
3341
|
-
}
|
|
3342
|
-
};
|
|
3343
|
-
}
|
|
3344
|
-
// src/webhook/server.ts
|
|
3345
|
-
var SHUTDOWN_GRACE_MS = 5000;
|
|
3346
|
-
function defineNivaWebhookServer(options, adapter) {
|
|
3347
|
-
const handler = createNivaWebhookHandler(options);
|
|
3348
|
-
return {
|
|
3349
|
-
on: (event, fn) => handler.on(event, fn),
|
|
3350
|
-
off: (event) => handler.off(event),
|
|
3351
|
-
fetch: async (request) => handler.fetch(request),
|
|
3352
|
-
async serve(serveOptions = {}) {
|
|
3353
|
-
const shutdownGraceMs = serveOptions.shutdownGraceMs !== undefined && Number.isFinite(serveOptions.shutdownGraceMs) && serveOptions.shutdownGraceMs >= 0 ? serveOptions.shutdownGraceMs : SHUTDOWN_GRACE_MS;
|
|
3354
|
-
return adapter(async (request) => handler.fetch(request), {
|
|
3355
|
-
port: serveOptions.port ?? 0,
|
|
3356
|
-
hostname: serveOptions.hostname ?? "127.0.0.1",
|
|
3357
|
-
shutdownGraceMs
|
|
3358
|
-
});
|
|
3359
|
-
}
|
|
3360
|
-
};
|
|
3361
|
-
}
|
|
3362
|
-
|
|
1
|
+
import {
|
|
2
|
+
ERROR_CODES2,
|
|
3
|
+
COMMON_ERROR_CODES2,
|
|
4
|
+
ERROR_CODE_SETS2,
|
|
5
|
+
OPERATIONS2,
|
|
6
|
+
safe2,
|
|
7
|
+
createNivaClient2,
|
|
8
|
+
NIVA_WEBHOOK_EVENT_TYPES2,
|
|
9
|
+
DEFAULT_TOLERANCE_SECONDS2,
|
|
10
|
+
verifyNivaWebhook2,
|
|
11
|
+
DEFAULT_MAX_BODY_BYTES2,
|
|
12
|
+
createNivaWebhookHandler2,
|
|
13
|
+
defineNivaWebhookServer
|
|
14
|
+
} from "./chunk-3w2v383z.js";
|
|
15
|
+
import {
|
|
16
|
+
NivaError2,
|
|
17
|
+
NivaApiError2,
|
|
18
|
+
NivaConnectionError2,
|
|
19
|
+
NivaConfigurationError2,
|
|
20
|
+
NivaIncompatibleServerError2,
|
|
21
|
+
NivaUnavailableError2,
|
|
22
|
+
NivaWebhookError2,
|
|
23
|
+
isNivaApiError2
|
|
24
|
+
} from "./chunk-50ad2r7x.js";
|
|
3363
25
|
// src/webhook/serve-default.ts
|
|
3364
26
|
function createNivaWebhookServer(options) {
|
|
3365
27
|
return defineNivaWebhookServer(options, () => {
|
|
3366
|
-
throw new
|
|
28
|
+
throw new NivaWebhookError2("unsupported_runtime", "unsupported_runtime", "no webhook server adapter for this runtime; use fetch() or run on Node.js, Bun, or Deno");
|
|
3367
29
|
});
|
|
3368
30
|
}
|
|
3369
31
|
var WEBHOOK_RUNTIME = "default";
|
|
3370
32
|
export {
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
33
|
+
COMMON_ERROR_CODES2 as COMMON_ERROR_CODES,
|
|
34
|
+
DEFAULT_MAX_BODY_BYTES2 as DEFAULT_MAX_BODY_BYTES,
|
|
35
|
+
DEFAULT_TOLERANCE_SECONDS2 as DEFAULT_TOLERANCE_SECONDS,
|
|
36
|
+
ERROR_CODES2 as ERROR_CODES,
|
|
37
|
+
ERROR_CODE_SETS2 as ERROR_CODE_SETS,
|
|
38
|
+
NIVA_WEBHOOK_EVENT_TYPES2 as NIVA_WEBHOOK_EVENT_TYPES,
|
|
39
|
+
NivaApiError2 as NivaApiError,
|
|
40
|
+
NivaConfigurationError2 as NivaConfigurationError,
|
|
41
|
+
NivaConnectionError2 as NivaConnectionError,
|
|
42
|
+
NivaError2 as NivaError,
|
|
43
|
+
NivaIncompatibleServerError2 as NivaIncompatibleServerError,
|
|
44
|
+
NivaUnavailableError2 as NivaUnavailableError,
|
|
45
|
+
NivaWebhookError2 as NivaWebhookError,
|
|
46
|
+
OPERATIONS2 as OPERATIONS,
|
|
3377
47
|
WEBHOOK_RUNTIME,
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
NivaConfigurationError,
|
|
3385
|
-
NivaApiError,
|
|
3386
|
-
NIVA_WEBHOOK_EVENT_TYPES,
|
|
3387
|
-
ERROR_CODE_SETS,
|
|
3388
|
-
ERROR_CODES,
|
|
3389
|
-
DEFAULT_TOLERANCE_SECONDS,
|
|
3390
|
-
DEFAULT_MAX_BODY_BYTES,
|
|
3391
|
-
COMMON_ERROR_CODES
|
|
48
|
+
createNivaClient2 as createNivaClient,
|
|
49
|
+
createNivaWebhookHandler2 as createNivaWebhookHandler,
|
|
50
|
+
createNivaWebhookServer,
|
|
51
|
+
isNivaApiError2 as isNivaApiError,
|
|
52
|
+
safe2 as safe,
|
|
53
|
+
verifyNivaWebhook2 as verifyNivaWebhook
|
|
3392
54
|
};
|