@wildix/wda-stream-client 1.0.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.
Files changed (52) hide show
  1. package/dist-cjs/WdaStream.js +17 -0
  2. package/dist-cjs/WdaStreamClient.js +35 -0
  3. package/dist-cjs/commands/ConsumeEventCommand.js +41 -0
  4. package/dist-cjs/commands/DescribeEventCommand.js +41 -0
  5. package/dist-cjs/commands/GetOngoingConversationsCommand.js +41 -0
  6. package/dist-cjs/commands/index.js +6 -0
  7. package/dist-cjs/extensionConfiguration.js +2 -0
  8. package/dist-cjs/index.js +10 -0
  9. package/dist-cjs/models/WdaStreamServiceException.js +12 -0
  10. package/dist-cjs/models/index.js +4 -0
  11. package/dist-cjs/models/models_0.js +170 -0
  12. package/dist-cjs/protocols/Aws_restJson1.js +262 -0
  13. package/dist-cjs/runtimeConfig.browser.js +28 -0
  14. package/dist-cjs/runtimeConfig.js +32 -0
  15. package/dist-cjs/runtimeConfig.native.js +15 -0
  16. package/dist-cjs/runtimeConfig.shared.js +19 -0
  17. package/dist-cjs/runtimeExtensions.js +19 -0
  18. package/dist-es/WdaStream.js +13 -0
  19. package/dist-es/WdaStreamClient.js +31 -0
  20. package/dist-es/commands/ConsumeEventCommand.js +37 -0
  21. package/dist-es/commands/DescribeEventCommand.js +37 -0
  22. package/dist-es/commands/GetOngoingConversationsCommand.js +37 -0
  23. package/dist-es/commands/index.js +3 -0
  24. package/dist-es/extensionConfiguration.js +1 -0
  25. package/dist-es/index.js +5 -0
  26. package/dist-es/models/WdaStreamServiceException.js +8 -0
  27. package/dist-es/models/index.js +1 -0
  28. package/dist-es/models/models_0.js +165 -0
  29. package/dist-es/protocols/Aws_restJson1.js +253 -0
  30. package/dist-es/runtimeConfig.browser.js +24 -0
  31. package/dist-es/runtimeConfig.js +28 -0
  32. package/dist-es/runtimeConfig.native.js +11 -0
  33. package/dist-es/runtimeConfig.shared.js +15 -0
  34. package/dist-es/runtimeExtensions.js +15 -0
  35. package/dist-types/WdaStream.d.ts +30 -0
  36. package/dist-types/WdaStreamClient.d.ts +139 -0
  37. package/dist-types/commands/ConsumeEventCommand.d.ts +219 -0
  38. package/dist-types/commands/DescribeEventCommand.d.ts +327 -0
  39. package/dist-types/commands/GetOngoingConversationsCommand.d.ts +275 -0
  40. package/dist-types/commands/index.d.ts +3 -0
  41. package/dist-types/extensionConfiguration.d.ts +7 -0
  42. package/dist-types/index.d.ts +5 -0
  43. package/dist-types/models/WdaStreamServiceException.d.ts +13 -0
  44. package/dist-types/models/index.d.ts +1 -0
  45. package/dist-types/models/models_0.d.ts +857 -0
  46. package/dist-types/protocols/Aws_restJson1.d.ts +29 -0
  47. package/dist-types/runtimeConfig.browser.d.ts +29 -0
  48. package/dist-types/runtimeConfig.d.ts +29 -0
  49. package/dist-types/runtimeConfig.native.d.ts +28 -0
  50. package/dist-types/runtimeConfig.shared.d.ts +15 -0
  51. package/dist-types/runtimeExtensions.d.ts +17 -0
  52. package/package.json +77 -0
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WdaStream = void 0;
4
+ const WdaStreamClient_1 = require("./WdaStreamClient");
5
+ const ConsumeEventCommand_1 = require("./commands/ConsumeEventCommand");
6
+ const DescribeEventCommand_1 = require("./commands/DescribeEventCommand");
7
+ const GetOngoingConversationsCommand_1 = require("./commands/GetOngoingConversationsCommand");
8
+ const smithy_client_1 = require("@smithy/smithy-client");
9
+ const commands = {
10
+ ConsumeEventCommand: ConsumeEventCommand_1.ConsumeEventCommand,
11
+ DescribeEventCommand: DescribeEventCommand_1.DescribeEventCommand,
12
+ GetOngoingConversationsCommand: GetOngoingConversationsCommand_1.GetOngoingConversationsCommand,
13
+ };
14
+ class WdaStream extends WdaStreamClient_1.WdaStreamClient {
15
+ }
16
+ exports.WdaStream = WdaStream;
17
+ (0, smithy_client_1.createAggregatedClient)(commands, WdaStream);
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WdaStreamClient = exports.__Client = void 0;
4
+ const runtimeConfig_1 = require("./runtimeConfig");
5
+ const runtimeExtensions_1 = require("./runtimeExtensions");
6
+ const smithy_client_1 = require("@smithy/smithy-client");
7
+ Object.defineProperty(exports, "__Client", { enumerable: true, get: function () { return smithy_client_1.Client; } });
8
+ const smithy_utils_1 = require("@wildix/smithy-utils");
9
+ class WdaStreamClient extends smithy_client_1.Client {
10
+ constructor(...[configuration]) {
11
+ let _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration || {});
12
+ let _config_1 = (0, runtimeExtensions_1.resolveRuntimeExtensions)(_config_0, configuration?.extensions || []);
13
+ super(_config_1);
14
+ this.config = _config_1;
15
+ const endpoint = () => {
16
+ return {
17
+ hostname: configuration.env === 'prod' || !configuration.env ? 'wda.wildix.com' : configuration.env === 'stable' ? 'wda-stable.wildix.com' : 'wda-stage.wildix.com',
18
+ protocol: "https",
19
+ port: '443',
20
+ path: ''
21
+ };
22
+ };
23
+ const config = {
24
+ ..._config_1,
25
+ endpoint,
26
+ };
27
+ super(config);
28
+ this.config = config;
29
+ this.middlewareStack.add(smithy_utils_1.authorizationMiddleware.bind(this, configuration.token), { step: "build" });
30
+ }
31
+ destroy() {
32
+ super.destroy();
33
+ }
34
+ }
35
+ exports.WdaStreamClient = WdaStreamClient;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConsumeEventCommand = exports.$Command = void 0;
4
+ const Aws_restJson1_1 = require("../protocols/Aws_restJson1");
5
+ const middleware_serde_1 = require("@smithy/middleware-serde");
6
+ const smithy_client_1 = require("@smithy/smithy-client");
7
+ Object.defineProperty(exports, "$Command", { enumerable: true, get: function () { return smithy_client_1.Command; } });
8
+ const types_1 = require("@smithy/types");
9
+ class ConsumeEventCommand extends smithy_client_1.Command {
10
+ constructor(input) {
11
+ super();
12
+ this.input = input;
13
+ }
14
+ resolveMiddleware(clientStack, configuration, options) {
15
+ this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize));
16
+ const stack = clientStack.concat(this.middlewareStack);
17
+ const { logger } = configuration;
18
+ const clientName = "WdaStreamClient";
19
+ const commandName = "ConsumeEventCommand";
20
+ const handlerExecutionContext = {
21
+ logger,
22
+ clientName,
23
+ commandName,
24
+ inputFilterSensitiveLog: (_) => _,
25
+ outputFilterSensitiveLog: (_) => _,
26
+ [types_1.SMITHY_CONTEXT_KEY]: {
27
+ service: "WdaStream",
28
+ operation: "ConsumeEvent",
29
+ },
30
+ };
31
+ const { requestHandler } = configuration;
32
+ return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
33
+ }
34
+ serialize(input, context) {
35
+ return (0, Aws_restJson1_1.se_ConsumeEventCommand)(input, context);
36
+ }
37
+ deserialize(output, context) {
38
+ return (0, Aws_restJson1_1.de_ConsumeEventCommand)(output, context);
39
+ }
40
+ }
41
+ exports.ConsumeEventCommand = ConsumeEventCommand;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DescribeEventCommand = exports.$Command = void 0;
4
+ const Aws_restJson1_1 = require("../protocols/Aws_restJson1");
5
+ const middleware_serde_1 = require("@smithy/middleware-serde");
6
+ const smithy_client_1 = require("@smithy/smithy-client");
7
+ Object.defineProperty(exports, "$Command", { enumerable: true, get: function () { return smithy_client_1.Command; } });
8
+ const types_1 = require("@smithy/types");
9
+ class DescribeEventCommand extends smithy_client_1.Command {
10
+ constructor(input) {
11
+ super();
12
+ this.input = input;
13
+ }
14
+ resolveMiddleware(clientStack, configuration, options) {
15
+ this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize));
16
+ const stack = clientStack.concat(this.middlewareStack);
17
+ const { logger } = configuration;
18
+ const clientName = "WdaStreamClient";
19
+ const commandName = "DescribeEventCommand";
20
+ const handlerExecutionContext = {
21
+ logger,
22
+ clientName,
23
+ commandName,
24
+ inputFilterSensitiveLog: (_) => _,
25
+ outputFilterSensitiveLog: (_) => _,
26
+ [types_1.SMITHY_CONTEXT_KEY]: {
27
+ service: "WdaStream",
28
+ operation: "DescribeEvent",
29
+ },
30
+ };
31
+ const { requestHandler } = configuration;
32
+ return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
33
+ }
34
+ serialize(input, context) {
35
+ return (0, Aws_restJson1_1.se_DescribeEventCommand)(input, context);
36
+ }
37
+ deserialize(output, context) {
38
+ return (0, Aws_restJson1_1.de_DescribeEventCommand)(output, context);
39
+ }
40
+ }
41
+ exports.DescribeEventCommand = DescribeEventCommand;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetOngoingConversationsCommand = exports.$Command = void 0;
4
+ const Aws_restJson1_1 = require("../protocols/Aws_restJson1");
5
+ const middleware_serde_1 = require("@smithy/middleware-serde");
6
+ const smithy_client_1 = require("@smithy/smithy-client");
7
+ Object.defineProperty(exports, "$Command", { enumerable: true, get: function () { return smithy_client_1.Command; } });
8
+ const types_1 = require("@smithy/types");
9
+ class GetOngoingConversationsCommand extends smithy_client_1.Command {
10
+ constructor(input) {
11
+ super();
12
+ this.input = input;
13
+ }
14
+ resolveMiddleware(clientStack, configuration, options) {
15
+ this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize));
16
+ const stack = clientStack.concat(this.middlewareStack);
17
+ const { logger } = configuration;
18
+ const clientName = "WdaStreamClient";
19
+ const commandName = "GetOngoingConversationsCommand";
20
+ const handlerExecutionContext = {
21
+ logger,
22
+ clientName,
23
+ commandName,
24
+ inputFilterSensitiveLog: (_) => _,
25
+ outputFilterSensitiveLog: (_) => _,
26
+ [types_1.SMITHY_CONTEXT_KEY]: {
27
+ service: "WdaStream",
28
+ operation: "GetOngoingConversations",
29
+ },
30
+ };
31
+ const { requestHandler } = configuration;
32
+ return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
33
+ }
34
+ serialize(input, context) {
35
+ return (0, Aws_restJson1_1.se_GetOngoingConversationsCommand)(input, context);
36
+ }
37
+ deserialize(output, context) {
38
+ return (0, Aws_restJson1_1.de_GetOngoingConversationsCommand)(output, context);
39
+ }
40
+ }
41
+ exports.GetOngoingConversationsCommand = GetOngoingConversationsCommand;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./ConsumeEventCommand"), exports);
5
+ tslib_1.__exportStar(require("./DescribeEventCommand"), exports);
6
+ tslib_1.__exportStar(require("./GetOngoingConversationsCommand"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WdaStreamServiceException = void 0;
4
+ const tslib_1 = require("tslib");
5
+ tslib_1.__exportStar(require("./WdaStreamClient"), exports);
6
+ tslib_1.__exportStar(require("./WdaStream"), exports);
7
+ tslib_1.__exportStar(require("./commands"), exports);
8
+ tslib_1.__exportStar(require("./models"), exports);
9
+ var WdaStreamServiceException_1 = require("./models/WdaStreamServiceException");
10
+ Object.defineProperty(exports, "WdaStreamServiceException", { enumerable: true, get: function () { return WdaStreamServiceException_1.WdaStreamServiceException; } });
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WdaStreamServiceException = exports.__ServiceException = void 0;
4
+ const smithy_client_1 = require("@smithy/smithy-client");
5
+ Object.defineProperty(exports, "__ServiceException", { enumerable: true, get: function () { return smithy_client_1.ServiceException; } });
6
+ class WdaStreamServiceException extends smithy_client_1.ServiceException {
7
+ constructor(options) {
8
+ super(options);
9
+ Object.setPrototypeOf(this, WdaStreamServiceException.prototype);
10
+ }
11
+ }
12
+ exports.WdaStreamServiceException = WdaStreamServiceException;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./models_0"), exports);
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConsumeEventInputEvent = exports.SmsStatus = exports.SmsChannelType = exports.SmsConsumeEventType = exports.ConferenceTranscriptionStatus = exports.ConferenceParticipantType = exports.ConferenceParticipantRole = exports.ChatConsumeEventType = exports.ChatTag = exports.ChatStatus = exports.ChatParticipantType = exports.ChatParticipantRole = exports.ChatDirection = exports.ChannelType = exports.CallTranscriptionSpeaker = exports.CallFlowTranscriptionStatus = exports.CallFlowStatus = exports.CallDirection = exports.ConversationStatus = exports.CallDevice = exports.CallParticipantType = exports.CallParticipantRole = exports.CallFlowAttachmentType = exports.License = exports.LiveEventType = exports.ValidationException = exports.ForbiddenException = void 0;
4
+ const WdaStreamServiceException_1 = require("./WdaStreamServiceException");
5
+ class ForbiddenException extends WdaStreamServiceException_1.WdaStreamServiceException {
6
+ constructor(opts) {
7
+ super({
8
+ name: "ForbiddenException",
9
+ $fault: "client",
10
+ ...opts
11
+ });
12
+ this.name = "ForbiddenException";
13
+ this.$fault = "client";
14
+ Object.setPrototypeOf(this, ForbiddenException.prototype);
15
+ }
16
+ }
17
+ exports.ForbiddenException = ForbiddenException;
18
+ class ValidationException extends WdaStreamServiceException_1.WdaStreamServiceException {
19
+ constructor(opts) {
20
+ super({
21
+ name: "ValidationException",
22
+ $fault: "client",
23
+ ...opts
24
+ });
25
+ this.name = "ValidationException";
26
+ this.$fault = "client";
27
+ Object.setPrototypeOf(this, ValidationException.prototype);
28
+ }
29
+ }
30
+ exports.ValidationException = ValidationException;
31
+ exports.LiveEventType = {
32
+ CALL: "call",
33
+ CALL_COMPLETE: "call_complete",
34
+ CALL_INTERRUPTED: "call_interrupted",
35
+ CALL_TRANSCRIPTION: "call_transcription",
36
+ CALL_TRANSCRIPTION_COMPLETE: "call_transcription_complete",
37
+ CHAT: "chat",
38
+ CHAT_COMPLETE: "chat_complete",
39
+ CHAT_INTERRUPTED: "chat_interrupted",
40
+ CHAT_MISSED: "chat_missed",
41
+ CONFERENCE: "conference",
42
+ CONFERENCE_COMPLETE: "conference_complete",
43
+ CONFERENCE_INTERRUPTED: "conference_interrupted",
44
+ CONFERENCE_TRANSCRIPTION: "conference_transcription",
45
+ CONFERENCE_TRANSCRIPTION_COMPLETE: "conference_transcription_complete",
46
+ };
47
+ exports.License = {
48
+ XBEES: "x-bees",
49
+ };
50
+ exports.CallFlowAttachmentType = {
51
+ FAX: "FAX",
52
+ VOICEMAIL: "VOICEMAIL",
53
+ };
54
+ exports.CallParticipantRole = {
55
+ AGENT: "AGENT",
56
+ CLIENT: "CLIENT",
57
+ };
58
+ exports.CallParticipantType = {
59
+ LOCAL: "LOCAL",
60
+ REMOTE: "REMOTE",
61
+ };
62
+ exports.CallDevice = {
63
+ COLLABORATION_ANDROID: "COLLABORATION_ANDROID",
64
+ COLLABORATION_IOS: "COLLABORATION_IOS",
65
+ COLLABORATION_WEB: "COLLABORATION_WEB",
66
+ UNKNOWN: "UNKNOWN",
67
+ WILDIX_DEVICE: "WILDIX_DEVICE",
68
+ WILDIX_PHONE: "WILDIX_PHONE",
69
+ XBEES_ANDROID: "XBEES_ANDROID",
70
+ XBEES_IOS: "XBEES_IOS",
71
+ XBEES_WEB: "XBEES_WEB",
72
+ };
73
+ exports.ConversationStatus = {
74
+ COMPLETED: "COMPLETED",
75
+ MISSED: "MISSED",
76
+ };
77
+ exports.CallDirection = {
78
+ INBOUND: "INBOUND",
79
+ INTERNAL: "INTERNAL",
80
+ OUTBOUND: "OUTBOUND",
81
+ UNDEFINED: "UNDEFINED",
82
+ };
83
+ exports.CallFlowStatus = {
84
+ CONNECTING: "CONNECTING",
85
+ HOLD: "HOLD",
86
+ TALKING: "TALKING",
87
+ };
88
+ exports.CallFlowTranscriptionStatus = {
89
+ AVAILABLE: "AVAILABLE",
90
+ UNAVAILABLE: "UNAVAILABLE",
91
+ };
92
+ exports.CallTranscriptionSpeaker = {
93
+ CALLEE: "callee",
94
+ CALLER: "caller",
95
+ };
96
+ exports.ChannelType = {
97
+ DIRECT: "direct",
98
+ GROUP: "group",
99
+ };
100
+ exports.ChatDirection = {
101
+ INBOUND: "INBOUND",
102
+ INTERNAL: "INTERNAL",
103
+ OUTBOUND: "OUTBOUND",
104
+ };
105
+ exports.ChatParticipantRole = {
106
+ AGENT: "AGENT",
107
+ CLIENT: "CLIENT",
108
+ };
109
+ exports.ChatParticipantType = {
110
+ LOCAL: "LOCAL",
111
+ REMOTE: "REMOTE",
112
+ };
113
+ exports.ChatStatus = {
114
+ COMPLETED: "COMPLETED",
115
+ MISSED: "MISSED",
116
+ WAITFIRSTREPLY: "WAITFIRSTREPLY",
117
+ WAITREPLYFROMAGENT: "WAITREPLYFROMAGENT",
118
+ WAITREPLYFROMGUEST: "WAITREPLYFROMGUEST",
119
+ };
120
+ exports.ChatTag = {
121
+ SMS: "sms",
122
+ TELEPHONY: "telephony",
123
+ };
124
+ exports.ChatConsumeEventType = {
125
+ CHAT_NEW: "CHAT.NEW",
126
+ CHAT_UPDATE: "CHAT.UPDATE",
127
+ };
128
+ exports.ConferenceParticipantRole = {
129
+ AGENT: "AGENT",
130
+ CLIENT: "CLIENT",
131
+ };
132
+ exports.ConferenceParticipantType = {
133
+ EXTERNAL: "EXTERNAL",
134
+ EXTERNAL_DIAL_IN: "EXTERNAL_DIAL_IN",
135
+ PBX: "PBX",
136
+ PBX_SIP: "PBX_SIP",
137
+ XBS: "XBS",
138
+ };
139
+ exports.ConferenceTranscriptionStatus = {
140
+ AVAILABLE: "AVAILABLE",
141
+ UNAVAILABLE: "UNAVAILABLE",
142
+ };
143
+ exports.SmsConsumeEventType = {
144
+ SMS_INBOUND: "SMS.INBOUND",
145
+ SMS_STATUS: "SMS.STATUS",
146
+ };
147
+ exports.SmsChannelType = {
148
+ ONE_WAY: "1-way-sms",
149
+ TWO_WAY: "2-way-sms",
150
+ };
151
+ exports.SmsStatus = {
152
+ DELIVERED: "delivered",
153
+ ERROR: "error",
154
+ SENT: "sent",
155
+ TRYING: "trying",
156
+ };
157
+ var ConsumeEventInputEvent;
158
+ (function (ConsumeEventInputEvent) {
159
+ ConsumeEventInputEvent.visit = (value, visitor) => {
160
+ if (value.chatNew !== undefined)
161
+ return visitor.chatNew(value.chatNew);
162
+ if (value.chatUpdate !== undefined)
163
+ return visitor.chatUpdate(value.chatUpdate);
164
+ if (value.smsInbound !== undefined)
165
+ return visitor.smsInbound(value.smsInbound);
166
+ if (value.smsStatus !== undefined)
167
+ return visitor.smsStatus(value.smsStatus);
168
+ return visitor._(value.$unknown[0], value.$unknown[1]);
169
+ };
170
+ })(ConsumeEventInputEvent = exports.ConsumeEventInputEvent || (exports.ConsumeEventInputEvent = {}));
@@ -0,0 +1,262 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.de_GetOngoingConversationsCommand = exports.de_DescribeEventCommand = exports.de_ConsumeEventCommand = exports.se_GetOngoingConversationsCommand = exports.se_DescribeEventCommand = exports.se_ConsumeEventCommand = void 0;
4
+ const WdaStreamServiceException_1 = require("../models/WdaStreamServiceException");
5
+ const models_0_1 = require("../models/models_0");
6
+ const protocol_http_1 = require("@smithy/protocol-http");
7
+ const smithy_client_1 = require("@smithy/smithy-client");
8
+ const se_ConsumeEventCommand = async (input, context) => {
9
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
10
+ const headers = {
11
+ 'content-type': 'application/json',
12
+ };
13
+ let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}` + "/v2/stream/events/consume";
14
+ let body;
15
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
16
+ 'event': _ => (0, smithy_client_1._json)(_),
17
+ }));
18
+ return new protocol_http_1.HttpRequest({
19
+ protocol,
20
+ hostname,
21
+ port,
22
+ method: "POST",
23
+ headers,
24
+ path: resolvedPath,
25
+ body,
26
+ });
27
+ };
28
+ exports.se_ConsumeEventCommand = se_ConsumeEventCommand;
29
+ const se_DescribeEventCommand = async (input, context) => {
30
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
31
+ const headers = {
32
+ 'content-type': 'application/json',
33
+ };
34
+ let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}` + "/v2/stream/events/describe";
35
+ let body;
36
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
37
+ 'SmsInboundEvent': _ => (0, smithy_client_1._json)(_),
38
+ 'SmsStatusEvent': _ => (0, smithy_client_1._json)(_),
39
+ }));
40
+ return new protocol_http_1.HttpRequest({
41
+ protocol,
42
+ hostname,
43
+ port,
44
+ method: "POST",
45
+ headers,
46
+ path: resolvedPath,
47
+ body,
48
+ });
49
+ };
50
+ exports.se_DescribeEventCommand = se_DescribeEventCommand;
51
+ const se_GetOngoingConversationsCommand = async (input, context) => {
52
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
53
+ const headers = {};
54
+ let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}` + "/v2/stream/conversations";
55
+ const query = (0, smithy_client_1.map)({
56
+ "company": [, input.company],
57
+ });
58
+ let body;
59
+ return new protocol_http_1.HttpRequest({
60
+ protocol,
61
+ hostname,
62
+ port,
63
+ method: "GET",
64
+ headers,
65
+ path: resolvedPath,
66
+ query,
67
+ body,
68
+ });
69
+ };
70
+ exports.se_GetOngoingConversationsCommand = se_GetOngoingConversationsCommand;
71
+ const de_ConsumeEventCommand = async (output, context) => {
72
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
73
+ return de_ConsumeEventCommandError(output, context);
74
+ }
75
+ const contents = (0, smithy_client_1.map)({
76
+ $metadata: deserializeMetadata(output),
77
+ });
78
+ await (0, smithy_client_1.collectBody)(output.body, context);
79
+ return contents;
80
+ };
81
+ exports.de_ConsumeEventCommand = de_ConsumeEventCommand;
82
+ const de_ConsumeEventCommandError = async (output, context) => {
83
+ const parsedOutput = {
84
+ ...output,
85
+ body: await parseErrorBody(output.body, context)
86
+ };
87
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
88
+ switch (errorCode) {
89
+ case "ValidationException":
90
+ case "smithy.framework#ValidationException":
91
+ throw await de_ValidationExceptionRes(parsedOutput, context);
92
+ default:
93
+ const parsedBody = parsedOutput.body;
94
+ return throwDefaultError({
95
+ output,
96
+ parsedBody,
97
+ errorCode
98
+ });
99
+ }
100
+ };
101
+ const de_DescribeEventCommand = async (output, context) => {
102
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
103
+ return de_DescribeEventCommandError(output, context);
104
+ }
105
+ const contents = (0, smithy_client_1.map)({
106
+ $metadata: deserializeMetadata(output),
107
+ });
108
+ const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await parseBody(output.body, context))), "body");
109
+ const doc = (0, smithy_client_1.take)(data, {
110
+ 'CallAnalyticsLiveCompleteEvent': smithy_client_1._json,
111
+ 'CallAnalyticsLiveInterruptedEvent': smithy_client_1._json,
112
+ 'CallAnalyticsLiveProgressEvent': smithy_client_1._json,
113
+ 'CallAnalyticsLiveTranscriptionCompleteEvent': smithy_client_1._json,
114
+ 'CallAnalyticsLiveTranscriptionEvent': smithy_client_1._json,
115
+ 'ConferenceAnalyticsLiveCompleteEvent': smithy_client_1._json,
116
+ 'ConferenceAnalyticsLiveInterruptedEvent': smithy_client_1._json,
117
+ 'ConferenceAnalyticsLiveProgressEvent': smithy_client_1._json,
118
+ 'ConferenceAnalyticsLiveTranscriptionCompleteEvent': smithy_client_1._json,
119
+ 'ConferenceAnalyticsLiveTranscriptionEvent': smithy_client_1._json,
120
+ });
121
+ Object.assign(contents, doc);
122
+ return contents;
123
+ };
124
+ exports.de_DescribeEventCommand = de_DescribeEventCommand;
125
+ const de_DescribeEventCommandError = async (output, context) => {
126
+ const parsedOutput = {
127
+ ...output,
128
+ body: await parseErrorBody(output.body, context)
129
+ };
130
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
131
+ switch (errorCode) {
132
+ case "ValidationException":
133
+ case "smithy.framework#ValidationException":
134
+ throw await de_ValidationExceptionRes(parsedOutput, context);
135
+ default:
136
+ const parsedBody = parsedOutput.body;
137
+ return throwDefaultError({
138
+ output,
139
+ parsedBody,
140
+ errorCode
141
+ });
142
+ }
143
+ };
144
+ const de_GetOngoingConversationsCommand = async (output, context) => {
145
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
146
+ return de_GetOngoingConversationsCommandError(output, context);
147
+ }
148
+ const contents = (0, smithy_client_1.map)({
149
+ $metadata: deserializeMetadata(output),
150
+ });
151
+ const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await parseBody(output.body, context))), "body");
152
+ const doc = (0, smithy_client_1.take)(data, {
153
+ 'calls': smithy_client_1._json,
154
+ 'chats': smithy_client_1._json,
155
+ 'conferences': smithy_client_1._json,
156
+ });
157
+ Object.assign(contents, doc);
158
+ return contents;
159
+ };
160
+ exports.de_GetOngoingConversationsCommand = de_GetOngoingConversationsCommand;
161
+ const de_GetOngoingConversationsCommandError = async (output, context) => {
162
+ const parsedOutput = {
163
+ ...output,
164
+ body: await parseErrorBody(output.body, context)
165
+ };
166
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
167
+ switch (errorCode) {
168
+ case "ForbiddenException":
169
+ case "smithy.framework#ForbiddenException":
170
+ throw await de_ForbiddenExceptionRes(parsedOutput, context);
171
+ case "ValidationException":
172
+ case "smithy.framework#ValidationException":
173
+ throw await de_ValidationExceptionRes(parsedOutput, context);
174
+ default:
175
+ const parsedBody = parsedOutput.body;
176
+ return throwDefaultError({
177
+ output,
178
+ parsedBody,
179
+ errorCode
180
+ });
181
+ }
182
+ };
183
+ const throwDefaultError = (0, smithy_client_1.withBaseException)(WdaStreamServiceException_1.WdaStreamServiceException);
184
+ const de_ForbiddenExceptionRes = async (parsedOutput, context) => {
185
+ const contents = (0, smithy_client_1.map)({});
186
+ const data = parsedOutput.body;
187
+ const doc = (0, smithy_client_1.take)(data, {
188
+ 'message': smithy_client_1.expectString,
189
+ });
190
+ Object.assign(contents, doc);
191
+ const exception = new models_0_1.ForbiddenException({
192
+ $metadata: deserializeMetadata(parsedOutput),
193
+ ...contents
194
+ });
195
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
196
+ };
197
+ const de_ValidationExceptionRes = async (parsedOutput, context) => {
198
+ const contents = (0, smithy_client_1.map)({});
199
+ const data = parsedOutput.body;
200
+ const doc = (0, smithy_client_1.take)(data, {
201
+ 'message': smithy_client_1.expectString,
202
+ });
203
+ Object.assign(contents, doc);
204
+ const exception = new models_0_1.ValidationException({
205
+ $metadata: deserializeMetadata(parsedOutput),
206
+ ...contents
207
+ });
208
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
209
+ };
210
+ const deserializeMetadata = (output) => ({
211
+ httpStatusCode: output.statusCode,
212
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
213
+ extendedRequestId: output.headers["x-amz-id-2"],
214
+ cfId: output.headers["x-amz-cf-id"],
215
+ });
216
+ const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then(body => context.utf8Encoder(body));
217
+ const isSerializableHeaderValue = (value) => value !== undefined &&
218
+ value !== null &&
219
+ value !== "" &&
220
+ (!Object.getOwnPropertyNames(value).includes("length") ||
221
+ value.length != 0) &&
222
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
223
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then(encoded => {
224
+ if (encoded.length) {
225
+ return JSON.parse(encoded);
226
+ }
227
+ return {};
228
+ });
229
+ const parseErrorBody = async (errorBody, context) => {
230
+ const value = await parseBody(errorBody, context);
231
+ value.message = value.message ?? value.Message;
232
+ return value;
233
+ };
234
+ const loadRestJsonErrorCode = (output, data) => {
235
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
236
+ const sanitizeErrorCode = (rawValue) => {
237
+ let cleanValue = rawValue;
238
+ if (typeof cleanValue === "number") {
239
+ cleanValue = cleanValue.toString();
240
+ }
241
+ if (cleanValue.indexOf(",") >= 0) {
242
+ cleanValue = cleanValue.split(",")[0];
243
+ }
244
+ if (cleanValue.indexOf(":") >= 0) {
245
+ cleanValue = cleanValue.split(":")[0];
246
+ }
247
+ if (cleanValue.indexOf("#") >= 0) {
248
+ cleanValue = cleanValue.split("#")[1];
249
+ }
250
+ return cleanValue;
251
+ };
252
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
253
+ if (headerKey !== undefined) {
254
+ return sanitizeErrorCode(output.headers[headerKey]);
255
+ }
256
+ if (data.code !== undefined) {
257
+ return sanitizeErrorCode(data.code);
258
+ }
259
+ if (data["__type"] !== undefined) {
260
+ return sanitizeErrorCode(data["__type"]);
261
+ }
262
+ };