@wildix/wim-voicebots-client 1.0.1 → 1.0.2

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VoiceSessionNotFoundException = exports.VoiceBotNotFoundException = exports.VoiceBotEventType = exports.BotEndpoint = exports.ForbiddenException = exports.ValidationException = void 0;
3
+ exports.VoiceSessionNotFoundException = exports.VoiceBotNotFoundException = exports.BotEndpoint = exports.VoiceBotEventType = exports.ForbiddenException = exports.ValidationException = void 0;
4
4
  const VoiceBotsServiceException_1 = require("./VoiceBotsServiceException");
5
5
  class ValidationException extends VoiceBotsServiceException_1.VoiceBotsServiceException {
6
6
  constructor(opts) {
@@ -28,6 +28,14 @@ class ForbiddenException extends VoiceBotsServiceException_1.VoiceBotsServiceExc
28
28
  }
29
29
  }
30
30
  exports.ForbiddenException = ForbiddenException;
31
+ exports.VoiceBotEventType = {
32
+ COMPLETE: "complete",
33
+ ENDED: "ended",
34
+ INTERRUPTION: "interruption",
35
+ REPLY: "reply",
36
+ STARTED: "started",
37
+ TRANSCRIPTION: "transcription",
38
+ };
31
39
  var BotEndpoint;
32
40
  (function (BotEndpoint) {
33
41
  BotEndpoint.visit = (value, visitor) => {
@@ -42,12 +50,6 @@ var BotEndpoint;
42
50
  return visitor._(value.$unknown[0], value.$unknown[1]);
43
51
  };
44
52
  })(BotEndpoint = exports.BotEndpoint || (exports.BotEndpoint = {}));
45
- exports.VoiceBotEventType = {
46
- ENDED: "ended",
47
- INTERRUPTION: "interruption",
48
- REPLY: "reply",
49
- TRANSCRIPTION: "transcription",
50
- };
51
53
  class VoiceBotNotFoundException extends VoiceBotsServiceException_1.VoiceBotsServiceException {
52
54
  constructor(opts) {
53
55
  super({
@@ -221,14 +221,16 @@ const de_DescribeEventCommand = async (output, context) => {
221
221
  });
222
222
  const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await parseBody(output.body, context))), "body");
223
223
  const doc = (0, smithy_client_1.take)(data, {
224
- 'VoiceBotInterruptionWebhookEvent': smithy_client_1._json,
225
- 'VoiceBotInterruptionWebsocketEvent': smithy_client_1._json,
226
- 'VoiceBotReplyWebhookEvent': smithy_client_1._json,
227
- 'VoiceBotReplyWebsocketEvent': smithy_client_1._json,
228
- 'VoiceBotSessionEndedWebhookEvent': smithy_client_1._json,
229
- 'VoiceBotSessionEndedWebsocketEvent': smithy_client_1._json,
230
- 'VoiceBotTranscriptionWebhookEvent': smithy_client_1._json,
231
- 'VoiceBotTranscriptionWebsocketEvent': smithy_client_1._json,
224
+ 'CompleteWebhookEvent': smithy_client_1._json,
225
+ 'CompleteWebsocketEvent': smithy_client_1._json,
226
+ 'InterruptionWebhookEvent': smithy_client_1._json,
227
+ 'InterruptionWebsocketEvent': smithy_client_1._json,
228
+ 'ReplyWebhookEvent': smithy_client_1._json,
229
+ 'ReplyWebsocketEvent': smithy_client_1._json,
230
+ 'SessionEndedWebhookEvent': smithy_client_1._json,
231
+ 'SessionStartedWebhookEvent': smithy_client_1._json,
232
+ 'TranscriptionWebhookEvent': smithy_client_1._json,
233
+ 'TranscriptionWebsocketEvent': smithy_client_1._json,
232
234
  });
233
235
  Object.assign(contents, doc);
234
236
  return contents;
@@ -23,6 +23,14 @@ export class ForbiddenException extends __BaseException {
23
23
  Object.setPrototypeOf(this, ForbiddenException.prototype);
24
24
  }
25
25
  }
26
+ export const VoiceBotEventType = {
27
+ COMPLETE: "complete",
28
+ ENDED: "ended",
29
+ INTERRUPTION: "interruption",
30
+ REPLY: "reply",
31
+ STARTED: "started",
32
+ TRANSCRIPTION: "transcription",
33
+ };
26
34
  export var BotEndpoint;
27
35
  (function (BotEndpoint) {
28
36
  BotEndpoint.visit = (value, visitor) => {
@@ -37,12 +45,6 @@ export var BotEndpoint;
37
45
  return visitor._(value.$unknown[0], value.$unknown[1]);
38
46
  };
39
47
  })(BotEndpoint || (BotEndpoint = {}));
40
- export const VoiceBotEventType = {
41
- ENDED: "ended",
42
- INTERRUPTION: "interruption",
43
- REPLY: "reply",
44
- TRANSCRIPTION: "transcription",
45
- };
46
48
  export class VoiceBotNotFoundException extends __BaseException {
47
49
  constructor(opts) {
48
50
  super({
@@ -206,14 +206,16 @@ export const de_DescribeEventCommand = async (output, context) => {
206
206
  });
207
207
  const data = __expectNonNull((__expectObject(await parseBody(output.body, context))), "body");
208
208
  const doc = take(data, {
209
- 'VoiceBotInterruptionWebhookEvent': _json,
210
- 'VoiceBotInterruptionWebsocketEvent': _json,
211
- 'VoiceBotReplyWebhookEvent': _json,
212
- 'VoiceBotReplyWebsocketEvent': _json,
213
- 'VoiceBotSessionEndedWebhookEvent': _json,
214
- 'VoiceBotSessionEndedWebsocketEvent': _json,
215
- 'VoiceBotTranscriptionWebhookEvent': _json,
216
- 'VoiceBotTranscriptionWebsocketEvent': _json,
209
+ 'CompleteWebhookEvent': _json,
210
+ 'CompleteWebsocketEvent': _json,
211
+ 'InterruptionWebhookEvent': _json,
212
+ 'InterruptionWebsocketEvent': _json,
213
+ 'ReplyWebhookEvent': _json,
214
+ 'ReplyWebsocketEvent': _json,
215
+ 'SessionEndedWebhookEvent': _json,
216
+ 'SessionStartedWebhookEvent': _json,
217
+ 'TranscriptionWebhookEvent': _json,
218
+ 'TranscriptionWebsocketEvent': _json,
217
219
  });
218
220
  Object.assign(contents, doc);
219
221
  return contents;
@@ -39,81 +39,102 @@ declare const DescribeEventCommand_base: {
39
39
  * const command = new DescribeEventCommand(input);
40
40
  * const response = await client.send(command);
41
41
  * // { // DescribeEventOutput
42
- * // VoiceBotTranscriptionWebsocketEvent: { // VoiceBotTranscriptionWebsocketEvent
42
+ * // TranscriptionWebsocketEvent: { // TranscriptionWebsocketEvent
43
43
  * // type: "STRING_VALUE", // required
44
- * // event: { // VoiceBotTranscriptionEvent
45
- * // type: "ended" || "reply" || "transcription" || "interruption", // required
44
+ * // event: { // TranscriptionEvent
45
+ * // type: "started" || "ended" || "reply" || "transcription" || "interruption" || "complete", // required
46
46
  * // id: "STRING_VALUE", // required
47
47
  * // text: "STRING_VALUE", // required
48
48
  * // time: Number("long"), // required
49
49
  * // },
50
50
  * // },
51
- * // VoiceBotReplyWebsocketEvent: { // VoiceBotReplyWebsocketEvent
51
+ * // ReplyWebsocketEvent: { // ReplyWebsocketEvent
52
52
  * // type: "STRING_VALUE", // required
53
- * // event: { // VoiceBotReplyEvent
54
- * // type: "ended" || "reply" || "transcription" || "interruption", // required
53
+ * // event: { // ReplyEvent
54
+ * // type: "started" || "ended" || "reply" || "transcription" || "interruption" || "complete", // required
55
55
  * // id: "STRING_VALUE", // required
56
56
  * // text: "STRING_VALUE", // required
57
57
  * // startTime: Number("long"), // required
58
58
  * // endTime: Number("long"), // required
59
59
  * // },
60
60
  * // },
61
- * // VoiceBotInterruptionWebsocketEvent: { // VoiceBotInterruptionWebsocketEvent
61
+ * // InterruptionWebsocketEvent: { // InterruptionWebsocketEvent
62
62
  * // type: "STRING_VALUE", // required
63
- * // event: { // VoiceBotInterruptionEvent
64
- * // type: "ended" || "reply" || "transcription" || "interruption", // required
63
+ * // event: { // InterruptionEvent
64
+ * // type: "started" || "ended" || "reply" || "transcription" || "interruption" || "complete", // required
65
65
  * // replyId: "STRING_VALUE", // required
66
66
  * // playedText: "STRING_VALUE", // required
67
67
  * // originalText: "STRING_VALUE", // required
68
68
  * // time: Number("long"), // required
69
69
  * // },
70
70
  * // },
71
- * // VoiceBotSessionEndedWebsocketEvent: { // VoiceBotSessionEndedWebsocketEvent
71
+ * // CompleteWebsocketEvent: { // CompleteWebsocketEvent
72
72
  * // type: "STRING_VALUE", // required
73
- * // event: { // VoiceBotSessionEndedEvent
74
- * // type: "ended" || "reply" || "transcription" || "interruption", // required
73
+ * // event: { // CompleteEvent
74
+ * // type: "started" || "ended" || "reply" || "transcription" || "interruption" || "complete", // required
75
75
  * // time: Number("long"), // required
76
76
  * // },
77
77
  * // },
78
- * // VoiceBotTranscriptionWebhookEvent: { // VoiceBotTranscriptionWebhookEvent
78
+ * // SessionStartedWebhookEvent: { // SessionStartedWebhookEvent
79
+ * // sessionId: "STRING_VALUE", // required
80
+ * // botId: "STRING_VALUE", // required
81
+ * // callId: "STRING_VALUE", // required
82
+ * // flowIndex: Number("int"), // required
83
+ * // event: { // SessionStartedEvent
84
+ * // type: "started" || "ended" || "reply" || "transcription" || "interruption" || "complete", // required
85
+ * // time: Number("long"), // required
86
+ * // },
87
+ * // },
88
+ * // SessionEndedWebhookEvent: { // SessionEndedWebhookEvent
89
+ * // sessionId: "STRING_VALUE", // required
90
+ * // botId: "STRING_VALUE", // required
91
+ * // callId: "STRING_VALUE", // required
92
+ * // flowIndex: Number("int"), // required
93
+ * // event: { // SessionEndedEvent
94
+ * // type: "started" || "ended" || "reply" || "transcription" || "interruption" || "complete", // required
95
+ * // error: "STRING_VALUE",
96
+ * // time: Number("long"), // required
97
+ * // },
98
+ * // },
99
+ * // TranscriptionWebhookEvent: { // TranscriptionWebhookEvent
79
100
  * // sessionId: "STRING_VALUE", // required
80
101
  * // botId: "STRING_VALUE", // required
81
102
  * // callId: "STRING_VALUE", // required
82
103
  * // flowIndex: Number("int"), // required
83
104
  * // event: {
84
- * // type: "ended" || "reply" || "transcription" || "interruption", // required
105
+ * // type: "started" || "ended" || "reply" || "transcription" || "interruption" || "complete", // required
85
106
  * // id: "STRING_VALUE", // required
86
107
  * // text: "STRING_VALUE", // required
87
108
  * // time: Number("long"), // required
88
109
  * // },
89
110
  * // },
90
- * // VoiceBotReplyWebhookEvent: { // VoiceBotReplyWebhookEvent
111
+ * // ReplyWebhookEvent: { // ReplyWebhookEvent
91
112
  * // sessionId: "STRING_VALUE", // required
92
113
  * // botId: "STRING_VALUE", // required
93
114
  * // callId: "STRING_VALUE", // required
94
115
  * // flowIndex: Number("int"), // required
95
116
  * // event: {
96
- * // type: "ended" || "reply" || "transcription" || "interruption", // required
117
+ * // type: "started" || "ended" || "reply" || "transcription" || "interruption" || "complete", // required
97
118
  * // id: "STRING_VALUE", // required
98
119
  * // text: "STRING_VALUE", // required
99
120
  * // startTime: Number("long"), // required
100
121
  * // endTime: Number("long"), // required
101
122
  * // },
102
123
  * // },
103
- * // VoiceBotInterruptionWebhookEvent: { // VoiceBotInterruptionWebhookEvent
124
+ * // InterruptionWebhookEvent: { // InterruptionWebhookEvent
104
125
  * // sessionId: "STRING_VALUE", // required
105
126
  * // botId: "STRING_VALUE", // required
106
127
  * // callId: "STRING_VALUE", // required
107
128
  * // flowIndex: Number("int"), // required
108
129
  * // event: {
109
- * // type: "ended" || "reply" || "transcription" || "interruption", // required
130
+ * // type: "started" || "ended" || "reply" || "transcription" || "interruption" || "complete", // required
110
131
  * // replyId: "STRING_VALUE", // required
111
132
  * // playedText: "STRING_VALUE", // required
112
133
  * // originalText: "STRING_VALUE", // required
113
134
  * // time: Number("long"), // required
114
135
  * // },
115
136
  * // },
116
- * // VoiceBotSessionEndedWebhookEvent: { // VoiceBotSessionEndedWebhookEvent
137
+ * // CompleteWebhookEvent: { // CompleteWebhookEvent
117
138
  * // sessionId: "STRING_VALUE", // required
118
139
  * // botId: "STRING_VALUE", // required
119
140
  * // callId: "STRING_VALUE", // required
@@ -23,6 +23,45 @@ export declare class ForbiddenException extends __BaseException {
23
23
  */
24
24
  constructor(opts: __ExceptionOptionType<ForbiddenException, __BaseException>);
25
25
  }
26
+ /**
27
+ * @public
28
+ * @enum
29
+ */
30
+ export declare const VoiceBotEventType: {
31
+ readonly COMPLETE: "complete";
32
+ readonly ENDED: "ended";
33
+ readonly INTERRUPTION: "interruption";
34
+ readonly REPLY: "reply";
35
+ readonly STARTED: "started";
36
+ readonly TRANSCRIPTION: "transcription";
37
+ };
38
+ /**
39
+ * @public
40
+ */
41
+ export type VoiceBotEventType = typeof VoiceBotEventType[keyof typeof VoiceBotEventType];
42
+ /**
43
+ * @public
44
+ */
45
+ export interface CompleteEvent {
46
+ type: VoiceBotEventType;
47
+ time: number;
48
+ }
49
+ /**
50
+ * @public
51
+ */
52
+ export interface CompleteWebhookEvent {
53
+ sessionId: string;
54
+ botId: string;
55
+ callId: string;
56
+ flowIndex: number;
57
+ }
58
+ /**
59
+ * @public
60
+ */
61
+ export interface CompleteWebsocketEvent {
62
+ type: string;
63
+ event: CompleteEvent;
64
+ }
26
65
  /**
27
66
  * @public
28
67
  */
@@ -216,22 +255,8 @@ export interface DescribeEventInput {
216
255
  }
217
256
  /**
218
257
  * @public
219
- * @enum
220
258
  */
221
- export declare const VoiceBotEventType: {
222
- readonly ENDED: "ended";
223
- readonly INTERRUPTION: "interruption";
224
- readonly REPLY: "reply";
225
- readonly TRANSCRIPTION: "transcription";
226
- };
227
- /**
228
- * @public
229
- */
230
- export type VoiceBotEventType = typeof VoiceBotEventType[keyof typeof VoiceBotEventType];
231
- /**
232
- * @public
233
- */
234
- export interface VoiceBotInterruptionEvent {
259
+ export interface InterruptionEvent {
235
260
  type: VoiceBotEventType;
236
261
  replyId: string;
237
262
  playedText: string;
@@ -241,24 +266,24 @@ export interface VoiceBotInterruptionEvent {
241
266
  /**
242
267
  * @public
243
268
  */
244
- export interface VoiceBotInterruptionWebhookEvent {
269
+ export interface InterruptionWebhookEvent {
245
270
  sessionId: string;
246
271
  botId: string;
247
272
  callId: string;
248
273
  flowIndex: number;
249
- event: VoiceBotInterruptionEvent;
274
+ event: InterruptionEvent;
250
275
  }
251
276
  /**
252
277
  * @public
253
278
  */
254
- export interface VoiceBotInterruptionWebsocketEvent {
279
+ export interface InterruptionWebsocketEvent {
255
280
  type: string;
256
- event: VoiceBotInterruptionEvent;
281
+ event: InterruptionEvent;
257
282
  }
258
283
  /**
259
284
  * @public
260
285
  */
261
- export interface VoiceBotReplyEvent {
286
+ export interface ReplyEvent {
262
287
  type: VoiceBotEventType;
263
288
  id: string;
264
289
  text: string;
@@ -268,47 +293,59 @@ export interface VoiceBotReplyEvent {
268
293
  /**
269
294
  * @public
270
295
  */
271
- export interface VoiceBotReplyWebhookEvent {
296
+ export interface ReplyWebhookEvent {
272
297
  sessionId: string;
273
298
  botId: string;
274
299
  callId: string;
275
300
  flowIndex: number;
276
- event: VoiceBotReplyEvent;
301
+ event: ReplyEvent;
277
302
  }
278
303
  /**
279
304
  * @public
280
305
  */
281
- export interface VoiceBotReplyWebsocketEvent {
306
+ export interface ReplyWebsocketEvent {
282
307
  type: string;
283
- event: VoiceBotReplyEvent;
308
+ event: ReplyEvent;
309
+ }
310
+ /**
311
+ * @public
312
+ */
313
+ export interface SessionEndedEvent {
314
+ type: VoiceBotEventType;
315
+ error?: string;
316
+ time: number;
284
317
  }
285
318
  /**
286
319
  * @public
287
320
  */
288
- export interface VoiceBotSessionEndedWebhookEvent {
321
+ export interface SessionEndedWebhookEvent {
289
322
  sessionId: string;
290
323
  botId: string;
291
324
  callId: string;
292
325
  flowIndex: number;
326
+ event: SessionEndedEvent;
293
327
  }
294
328
  /**
295
329
  * @public
296
330
  */
297
- export interface VoiceBotSessionEndedEvent {
331
+ export interface SessionStartedEvent {
298
332
  type: VoiceBotEventType;
299
333
  time: number;
300
334
  }
301
335
  /**
302
336
  * @public
303
337
  */
304
- export interface VoiceBotSessionEndedWebsocketEvent {
305
- type: string;
306
- event: VoiceBotSessionEndedEvent;
338
+ export interface SessionStartedWebhookEvent {
339
+ sessionId: string;
340
+ botId: string;
341
+ callId: string;
342
+ flowIndex: number;
343
+ event: SessionStartedEvent;
307
344
  }
308
345
  /**
309
346
  * @public
310
347
  */
311
- export interface VoiceBotTranscriptionEvent {
348
+ export interface TranscriptionEvent {
312
349
  type: VoiceBotEventType;
313
350
  id: string;
314
351
  text: string;
@@ -317,32 +354,34 @@ export interface VoiceBotTranscriptionEvent {
317
354
  /**
318
355
  * @public
319
356
  */
320
- export interface VoiceBotTranscriptionWebhookEvent {
357
+ export interface TranscriptionWebhookEvent {
321
358
  sessionId: string;
322
359
  botId: string;
323
360
  callId: string;
324
361
  flowIndex: number;
325
- event: VoiceBotTranscriptionEvent;
362
+ event: TranscriptionEvent;
326
363
  }
327
364
  /**
328
365
  * @public
329
366
  */
330
- export interface VoiceBotTranscriptionWebsocketEvent {
367
+ export interface TranscriptionWebsocketEvent {
331
368
  type: string;
332
- event: VoiceBotTranscriptionEvent;
369
+ event: TranscriptionEvent;
333
370
  }
334
371
  /**
335
372
  * @public
336
373
  */
337
374
  export interface DescribeEventOutput {
338
- VoiceBotTranscriptionWebsocketEvent?: VoiceBotTranscriptionWebsocketEvent;
339
- VoiceBotReplyWebsocketEvent?: VoiceBotReplyWebsocketEvent;
340
- VoiceBotInterruptionWebsocketEvent?: VoiceBotInterruptionWebsocketEvent;
341
- VoiceBotSessionEndedWebsocketEvent?: VoiceBotSessionEndedWebsocketEvent;
342
- VoiceBotTranscriptionWebhookEvent?: VoiceBotTranscriptionWebhookEvent;
343
- VoiceBotReplyWebhookEvent?: VoiceBotReplyWebhookEvent;
344
- VoiceBotInterruptionWebhookEvent?: VoiceBotInterruptionWebhookEvent;
345
- VoiceBotSessionEndedWebhookEvent?: VoiceBotSessionEndedWebhookEvent;
375
+ TranscriptionWebsocketEvent?: TranscriptionWebsocketEvent;
376
+ ReplyWebsocketEvent?: ReplyWebsocketEvent;
377
+ InterruptionWebsocketEvent?: InterruptionWebsocketEvent;
378
+ CompleteWebsocketEvent?: CompleteWebsocketEvent;
379
+ SessionStartedWebhookEvent?: SessionStartedWebhookEvent;
380
+ SessionEndedWebhookEvent?: SessionEndedWebhookEvent;
381
+ TranscriptionWebhookEvent?: TranscriptionWebhookEvent;
382
+ ReplyWebhookEvent?: ReplyWebhookEvent;
383
+ InterruptionWebhookEvent?: InterruptionWebhookEvent;
384
+ CompleteWebhookEvent?: CompleteWebhookEvent;
346
385
  }
347
386
  /**
348
387
  * @public
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wildix/wim-voicebots-client",
3
3
  "description": "@wildix/wim-voicebots-client client",
4
- "version": "1.0.1",
4
+ "version": "1.0.2",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "tsc -p tsconfig.cjs.json",