@aws-sdk/client-lex-runtime-v2 3.476.0 → 3.477.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,163 +1,115 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.de_StartConversationCommand = exports.de_RecognizeUtteranceCommand = exports.de_RecognizeTextCommand = exports.de_PutSessionCommand = exports.de_GetSessionCommand = exports.de_DeleteSessionCommand = exports.se_StartConversationCommand = exports.se_RecognizeUtteranceCommand = exports.se_RecognizeTextCommand = exports.se_PutSessionCommand = exports.se_GetSessionCommand = exports.se_DeleteSessionCommand = void 0;
4
- const protocol_http_1 = require("@smithy/protocol-http");
4
+ const core_1 = require("@smithy/core");
5
5
  const smithy_client_1 = require("@smithy/smithy-client");
6
6
  const LexRuntimeV2ServiceException_1 = require("../models/LexRuntimeV2ServiceException");
7
7
  const models_0_1 = require("../models/models_0");
8
8
  const se_DeleteSessionCommand = async (input, context) => {
9
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
9
+ const b = (0, core_1.requestBuilder)(input, context);
10
10
  const headers = {};
11
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
12
- "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}";
13
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
14
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
15
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
16
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
11
+ b.bp("/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}");
12
+ b.p("botId", () => input.botId, "{botId}", false);
13
+ b.p("botAliasId", () => input.botAliasId, "{botAliasId}", false);
14
+ b.p("localeId", () => input.localeId, "{localeId}", false);
15
+ b.p("sessionId", () => input.sessionId, "{sessionId}", false);
17
16
  let body;
18
- return new protocol_http_1.HttpRequest({
19
- protocol,
20
- hostname,
21
- port,
22
- method: "DELETE",
23
- headers,
24
- path: resolvedPath,
25
- body,
26
- });
17
+ b.m("DELETE").h(headers).b(body);
18
+ return b.build();
27
19
  };
28
20
  exports.se_DeleteSessionCommand = se_DeleteSessionCommand;
29
21
  const se_GetSessionCommand = async (input, context) => {
30
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
22
+ const b = (0, core_1.requestBuilder)(input, context);
31
23
  const headers = {};
32
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
33
- "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}";
34
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
35
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
36
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
37
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
24
+ b.bp("/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}");
25
+ b.p("botId", () => input.botId, "{botId}", false);
26
+ b.p("botAliasId", () => input.botAliasId, "{botAliasId}", false);
27
+ b.p("localeId", () => input.localeId, "{localeId}", false);
28
+ b.p("sessionId", () => input.sessionId, "{sessionId}", false);
38
29
  let body;
39
- return new protocol_http_1.HttpRequest({
40
- protocol,
41
- hostname,
42
- port,
43
- method: "GET",
44
- headers,
45
- path: resolvedPath,
46
- body,
47
- });
30
+ b.m("GET").h(headers).b(body);
31
+ return b.build();
48
32
  };
49
33
  exports.se_GetSessionCommand = se_GetSessionCommand;
50
34
  const se_PutSessionCommand = async (input, context) => {
51
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
35
+ const b = (0, core_1.requestBuilder)(input, context);
52
36
  const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
53
37
  "content-type": "application/json",
54
- responsecontenttype: input.responseContentType,
38
+ [_r]: input[_rCT],
55
39
  });
56
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
57
- "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}";
58
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
59
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
60
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
61
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
40
+ b.bp("/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}");
41
+ b.p("botId", () => input.botId, "{botId}", false);
42
+ b.p("botAliasId", () => input.botAliasId, "{botAliasId}", false);
43
+ b.p("localeId", () => input.localeId, "{localeId}", false);
44
+ b.p("sessionId", () => input.sessionId, "{sessionId}", false);
62
45
  let body;
63
46
  body = JSON.stringify((0, smithy_client_1.take)(input, {
64
47
  messages: (_) => (0, smithy_client_1._json)(_),
65
48
  requestAttributes: (_) => (0, smithy_client_1._json)(_),
66
49
  sessionState: (_) => se_SessionState(_, context),
67
50
  }));
68
- return new protocol_http_1.HttpRequest({
69
- protocol,
70
- hostname,
71
- port,
72
- method: "POST",
73
- headers,
74
- path: resolvedPath,
75
- body,
76
- });
51
+ b.m("POST").h(headers).b(body);
52
+ return b.build();
77
53
  };
78
54
  exports.se_PutSessionCommand = se_PutSessionCommand;
79
55
  const se_RecognizeTextCommand = async (input, context) => {
80
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
56
+ const b = (0, core_1.requestBuilder)(input, context);
81
57
  const headers = {
82
58
  "content-type": "application/json",
83
59
  };
84
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
85
- "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/text";
86
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
87
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
88
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
89
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
60
+ b.bp("/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/text");
61
+ b.p("botId", () => input.botId, "{botId}", false);
62
+ b.p("botAliasId", () => input.botAliasId, "{botAliasId}", false);
63
+ b.p("localeId", () => input.localeId, "{localeId}", false);
64
+ b.p("sessionId", () => input.sessionId, "{sessionId}", false);
90
65
  let body;
91
66
  body = JSON.stringify((0, smithy_client_1.take)(input, {
92
67
  requestAttributes: (_) => (0, smithy_client_1._json)(_),
93
68
  sessionState: (_) => se_SessionState(_, context),
94
69
  text: [],
95
70
  }));
96
- return new protocol_http_1.HttpRequest({
97
- protocol,
98
- hostname,
99
- port,
100
- method: "POST",
101
- headers,
102
- path: resolvedPath,
103
- body,
104
- });
71
+ b.m("POST").h(headers).b(body);
72
+ return b.build();
105
73
  };
106
74
  exports.se_RecognizeTextCommand = se_RecognizeTextCommand;
107
75
  const se_RecognizeUtteranceCommand = async (input, context) => {
108
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
76
+ const b = (0, core_1.requestBuilder)(input, context);
109
77
  const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
110
78
  "x-amz-content-sha256": "UNSIGNED-PAYLOAD",
111
- "content-type": input.requestContentType || "application/octet-stream",
112
- "x-amz-lex-session-state": input.sessionState,
113
- "x-amz-lex-request-attributes": input.requestAttributes,
114
- "response-content-type": input.responseContentType,
79
+ [_ct]: input[_rCTe] || "application/octet-stream",
80
+ [_xalss]: input[_sS],
81
+ [_xalra]: input[_rA],
82
+ [_rct]: input[_rCT],
115
83
  });
116
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
117
- "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/utterance";
118
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
119
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
120
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
121
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
84
+ b.bp("/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/utterance");
85
+ b.p("botId", () => input.botId, "{botId}", false);
86
+ b.p("botAliasId", () => input.botAliasId, "{botAliasId}", false);
87
+ b.p("localeId", () => input.localeId, "{localeId}", false);
88
+ b.p("sessionId", () => input.sessionId, "{sessionId}", false);
122
89
  let body;
123
90
  if (input.inputStream !== undefined) {
124
91
  body = input.inputStream;
125
92
  }
126
- return new protocol_http_1.HttpRequest({
127
- protocol,
128
- hostname,
129
- port,
130
- method: "POST",
131
- headers,
132
- path: resolvedPath,
133
- body,
134
- });
93
+ b.m("POST").h(headers).b(body);
94
+ return b.build();
135
95
  };
136
96
  exports.se_RecognizeUtteranceCommand = se_RecognizeUtteranceCommand;
137
97
  const se_StartConversationCommand = async (input, context) => {
138
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
98
+ const b = (0, core_1.requestBuilder)(input, context);
139
99
  const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
140
- "x-amz-lex-conversation-mode": input.conversationMode,
100
+ [_xalcm]: input[_cM],
141
101
  });
142
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
143
- "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/conversation";
144
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
145
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
146
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
147
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
102
+ b.bp("/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/conversation");
103
+ b.p("botId", () => input.botId, "{botId}", false);
104
+ b.p("botAliasId", () => input.botAliasId, "{botAliasId}", false);
105
+ b.p("localeId", () => input.localeId, "{localeId}", false);
106
+ b.p("sessionId", () => input.sessionId, "{sessionId}", false);
148
107
  let body;
149
108
  if (input.requestEventStream !== undefined) {
150
109
  body = se_StartConversationRequestEventStream(input.requestEventStream, context);
151
110
  }
152
- return new protocol_http_1.HttpRequest({
153
- protocol,
154
- hostname,
155
- port,
156
- method: "POST",
157
- headers,
158
- path: resolvedPath,
159
- body,
160
- });
111
+ b.m("POST").h(headers).b(body);
112
+ return b.build();
161
113
  };
162
114
  exports.se_StartConversationCommand = se_StartConversationCommand;
163
115
  const de_DeleteSessionCommand = async (output, context) => {
@@ -267,11 +219,11 @@ const de_PutSessionCommand = async (output, context) => {
267
219
  }
268
220
  const contents = (0, smithy_client_1.map)({
269
221
  $metadata: deserializeMetadata(output),
270
- contentType: [, output.headers["content-type"]],
271
- messages: [, output.headers["x-amz-lex-messages"]],
272
- sessionState: [, output.headers["x-amz-lex-session-state"]],
273
- requestAttributes: [, output.headers["x-amz-lex-request-attributes"]],
274
- sessionId: [, output.headers["x-amz-lex-session-id"]],
222
+ [_cT]: [, output.headers[_ct]],
223
+ [_m]: [, output.headers[_xalm]],
224
+ [_sS]: [, output.headers[_xalss]],
225
+ [_rA]: [, output.headers[_xalra]],
226
+ [_sI]: [, output.headers[_xalsi]],
275
227
  });
276
228
  const data = output.body;
277
229
  context.sdkStreamMixin(data);
@@ -385,15 +337,15 @@ const de_RecognizeUtteranceCommand = async (output, context) => {
385
337
  }
386
338
  const contents = (0, smithy_client_1.map)({
387
339
  $metadata: deserializeMetadata(output),
388
- inputMode: [, output.headers["x-amz-lex-input-mode"]],
389
- contentType: [, output.headers["content-type"]],
390
- messages: [, output.headers["x-amz-lex-messages"]],
391
- interpretations: [, output.headers["x-amz-lex-interpretations"]],
392
- sessionState: [, output.headers["x-amz-lex-session-state"]],
393
- requestAttributes: [, output.headers["x-amz-lex-request-attributes"]],
394
- sessionId: [, output.headers["x-amz-lex-session-id"]],
395
- inputTranscript: [, output.headers["x-amz-lex-input-transcript"]],
396
- recognizedBotMember: [, output.headers["x-amz-lex-recognized-bot-member"]],
340
+ [_iM]: [, output.headers[_xalim]],
341
+ [_cT]: [, output.headers[_ct]],
342
+ [_m]: [, output.headers[_xalm]],
343
+ [_i]: [, output.headers[_xali]],
344
+ [_sS]: [, output.headers[_xalss]],
345
+ [_rA]: [, output.headers[_xalra]],
346
+ [_sI]: [, output.headers[_xalsi]],
347
+ [_iT]: [, output.headers[_xalit]],
348
+ [_rBM]: [, output.headers[_xalrbm]],
397
349
  });
398
350
  const data = output.body;
399
351
  context.sdkStreamMixin(data);
@@ -1086,6 +1038,30 @@ const isSerializableHeaderValue = (value) => value !== undefined &&
1086
1038
  value !== "" &&
1087
1039
  (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
1088
1040
  (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
1041
+ const _cM = "conversationMode";
1042
+ const _cT = "contentType";
1043
+ const _ct = "content-type";
1044
+ const _i = "interpretations";
1045
+ const _iM = "inputMode";
1046
+ const _iT = "inputTranscript";
1047
+ const _m = "messages";
1048
+ const _r = "responsecontenttype";
1049
+ const _rA = "requestAttributes";
1050
+ const _rBM = "recognizedBotMember";
1051
+ const _rCT = "responseContentType";
1052
+ const _rCTe = "requestContentType";
1053
+ const _rct = "response-content-type";
1054
+ const _sI = "sessionId";
1055
+ const _sS = "sessionState";
1056
+ const _xalcm = "x-amz-lex-conversation-mode";
1057
+ const _xali = "x-amz-lex-interpretations";
1058
+ const _xalim = "x-amz-lex-input-mode";
1059
+ const _xalit = "x-amz-lex-input-transcript";
1060
+ const _xalm = "x-amz-lex-messages";
1061
+ const _xalra = "x-amz-lex-request-attributes";
1062
+ const _xalrbm = "x-amz-lex-recognized-bot-member";
1063
+ const _xalsi = "x-amz-lex-session-id";
1064
+ const _xalss = "x-amz-lex-session-state";
1089
1065
  const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
1090
1066
  if (encoded.length) {
1091
1067
  return JSON.parse(encoded);
@@ -1,155 +1,107 @@
1
- import { HttpRequest as __HttpRequest } from "@smithy/protocol-http";
2
- import { _json, collectBody, decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, limitedParseDouble as __limitedParseDouble, map, resolvedPath as __resolvedPath, take, withBaseException, } from "@smithy/smithy-client";
1
+ import { requestBuilder as rb } from "@smithy/core";
2
+ import { _json, collectBody, decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, limitedParseDouble as __limitedParseDouble, map, take, withBaseException, } from "@smithy/smithy-client";
3
3
  import { LexRuntimeV2ServiceException as __BaseException } from "../models/LexRuntimeV2ServiceException";
4
4
  import { AccessDeniedException, BadGatewayException, ConflictException, DependencyFailedException, InternalServerException, ResourceNotFoundException, StartConversationRequestEventStream, ThrottlingException, ValidationException, } from "../models/models_0";
5
5
  export const se_DeleteSessionCommand = async (input, context) => {
6
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
6
+ const b = rb(input, context);
7
7
  const headers = {};
8
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
9
- "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}";
10
- resolvedPath = __resolvedPath(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
11
- resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
12
- resolvedPath = __resolvedPath(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
13
- resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
8
+ b.bp("/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}");
9
+ b.p("botId", () => input.botId, "{botId}", false);
10
+ b.p("botAliasId", () => input.botAliasId, "{botAliasId}", false);
11
+ b.p("localeId", () => input.localeId, "{localeId}", false);
12
+ b.p("sessionId", () => input.sessionId, "{sessionId}", false);
14
13
  let body;
15
- return new __HttpRequest({
16
- protocol,
17
- hostname,
18
- port,
19
- method: "DELETE",
20
- headers,
21
- path: resolvedPath,
22
- body,
23
- });
14
+ b.m("DELETE").h(headers).b(body);
15
+ return b.build();
24
16
  };
25
17
  export const se_GetSessionCommand = async (input, context) => {
26
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
18
+ const b = rb(input, context);
27
19
  const headers = {};
28
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
29
- "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}";
30
- resolvedPath = __resolvedPath(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
31
- resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
32
- resolvedPath = __resolvedPath(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
33
- resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
20
+ b.bp("/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}");
21
+ b.p("botId", () => input.botId, "{botId}", false);
22
+ b.p("botAliasId", () => input.botAliasId, "{botAliasId}", false);
23
+ b.p("localeId", () => input.localeId, "{localeId}", false);
24
+ b.p("sessionId", () => input.sessionId, "{sessionId}", false);
34
25
  let body;
35
- return new __HttpRequest({
36
- protocol,
37
- hostname,
38
- port,
39
- method: "GET",
40
- headers,
41
- path: resolvedPath,
42
- body,
43
- });
26
+ b.m("GET").h(headers).b(body);
27
+ return b.build();
44
28
  };
45
29
  export const se_PutSessionCommand = async (input, context) => {
46
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
30
+ const b = rb(input, context);
47
31
  const headers = map({}, isSerializableHeaderValue, {
48
32
  "content-type": "application/json",
49
- responsecontenttype: input.responseContentType,
33
+ [_r]: input[_rCT],
50
34
  });
51
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
52
- "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}";
53
- resolvedPath = __resolvedPath(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
54
- resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
55
- resolvedPath = __resolvedPath(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
56
- resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
35
+ b.bp("/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}");
36
+ b.p("botId", () => input.botId, "{botId}", false);
37
+ b.p("botAliasId", () => input.botAliasId, "{botAliasId}", false);
38
+ b.p("localeId", () => input.localeId, "{localeId}", false);
39
+ b.p("sessionId", () => input.sessionId, "{sessionId}", false);
57
40
  let body;
58
41
  body = JSON.stringify(take(input, {
59
42
  messages: (_) => _json(_),
60
43
  requestAttributes: (_) => _json(_),
61
44
  sessionState: (_) => se_SessionState(_, context),
62
45
  }));
63
- return new __HttpRequest({
64
- protocol,
65
- hostname,
66
- port,
67
- method: "POST",
68
- headers,
69
- path: resolvedPath,
70
- body,
71
- });
46
+ b.m("POST").h(headers).b(body);
47
+ return b.build();
72
48
  };
73
49
  export const se_RecognizeTextCommand = async (input, context) => {
74
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
50
+ const b = rb(input, context);
75
51
  const headers = {
76
52
  "content-type": "application/json",
77
53
  };
78
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
79
- "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/text";
80
- resolvedPath = __resolvedPath(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
81
- resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
82
- resolvedPath = __resolvedPath(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
83
- resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
54
+ b.bp("/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/text");
55
+ b.p("botId", () => input.botId, "{botId}", false);
56
+ b.p("botAliasId", () => input.botAliasId, "{botAliasId}", false);
57
+ b.p("localeId", () => input.localeId, "{localeId}", false);
58
+ b.p("sessionId", () => input.sessionId, "{sessionId}", false);
84
59
  let body;
85
60
  body = JSON.stringify(take(input, {
86
61
  requestAttributes: (_) => _json(_),
87
62
  sessionState: (_) => se_SessionState(_, context),
88
63
  text: [],
89
64
  }));
90
- return new __HttpRequest({
91
- protocol,
92
- hostname,
93
- port,
94
- method: "POST",
95
- headers,
96
- path: resolvedPath,
97
- body,
98
- });
65
+ b.m("POST").h(headers).b(body);
66
+ return b.build();
99
67
  };
100
68
  export const se_RecognizeUtteranceCommand = async (input, context) => {
101
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
69
+ const b = rb(input, context);
102
70
  const headers = map({}, isSerializableHeaderValue, {
103
71
  "x-amz-content-sha256": "UNSIGNED-PAYLOAD",
104
- "content-type": input.requestContentType || "application/octet-stream",
105
- "x-amz-lex-session-state": input.sessionState,
106
- "x-amz-lex-request-attributes": input.requestAttributes,
107
- "response-content-type": input.responseContentType,
72
+ [_ct]: input[_rCTe] || "application/octet-stream",
73
+ [_xalss]: input[_sS],
74
+ [_xalra]: input[_rA],
75
+ [_rct]: input[_rCT],
108
76
  });
109
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
110
- "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/utterance";
111
- resolvedPath = __resolvedPath(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
112
- resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
113
- resolvedPath = __resolvedPath(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
114
- resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
77
+ b.bp("/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/utterance");
78
+ b.p("botId", () => input.botId, "{botId}", false);
79
+ b.p("botAliasId", () => input.botAliasId, "{botAliasId}", false);
80
+ b.p("localeId", () => input.localeId, "{localeId}", false);
81
+ b.p("sessionId", () => input.sessionId, "{sessionId}", false);
115
82
  let body;
116
83
  if (input.inputStream !== undefined) {
117
84
  body = input.inputStream;
118
85
  }
119
- return new __HttpRequest({
120
- protocol,
121
- hostname,
122
- port,
123
- method: "POST",
124
- headers,
125
- path: resolvedPath,
126
- body,
127
- });
86
+ b.m("POST").h(headers).b(body);
87
+ return b.build();
128
88
  };
129
89
  export const se_StartConversationCommand = async (input, context) => {
130
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
90
+ const b = rb(input, context);
131
91
  const headers = map({}, isSerializableHeaderValue, {
132
- "x-amz-lex-conversation-mode": input.conversationMode,
92
+ [_xalcm]: input[_cM],
133
93
  });
134
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
135
- "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/conversation";
136
- resolvedPath = __resolvedPath(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
137
- resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
138
- resolvedPath = __resolvedPath(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
139
- resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
94
+ b.bp("/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/conversation");
95
+ b.p("botId", () => input.botId, "{botId}", false);
96
+ b.p("botAliasId", () => input.botAliasId, "{botAliasId}", false);
97
+ b.p("localeId", () => input.localeId, "{localeId}", false);
98
+ b.p("sessionId", () => input.sessionId, "{sessionId}", false);
140
99
  let body;
141
100
  if (input.requestEventStream !== undefined) {
142
101
  body = se_StartConversationRequestEventStream(input.requestEventStream, context);
143
102
  }
144
- return new __HttpRequest({
145
- protocol,
146
- hostname,
147
- port,
148
- method: "POST",
149
- headers,
150
- path: resolvedPath,
151
- body,
152
- });
103
+ b.m("POST").h(headers).b(body);
104
+ return b.build();
153
105
  };
154
106
  export const de_DeleteSessionCommand = async (output, context) => {
155
107
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -256,11 +208,11 @@ export const de_PutSessionCommand = async (output, context) => {
256
208
  }
257
209
  const contents = map({
258
210
  $metadata: deserializeMetadata(output),
259
- contentType: [, output.headers["content-type"]],
260
- messages: [, output.headers["x-amz-lex-messages"]],
261
- sessionState: [, output.headers["x-amz-lex-session-state"]],
262
- requestAttributes: [, output.headers["x-amz-lex-request-attributes"]],
263
- sessionId: [, output.headers["x-amz-lex-session-id"]],
211
+ [_cT]: [, output.headers[_ct]],
212
+ [_m]: [, output.headers[_xalm]],
213
+ [_sS]: [, output.headers[_xalss]],
214
+ [_rA]: [, output.headers[_xalra]],
215
+ [_sI]: [, output.headers[_xalsi]],
264
216
  });
265
217
  const data = output.body;
266
218
  context.sdkStreamMixin(data);
@@ -372,15 +324,15 @@ export const de_RecognizeUtteranceCommand = async (output, context) => {
372
324
  }
373
325
  const contents = map({
374
326
  $metadata: deserializeMetadata(output),
375
- inputMode: [, output.headers["x-amz-lex-input-mode"]],
376
- contentType: [, output.headers["content-type"]],
377
- messages: [, output.headers["x-amz-lex-messages"]],
378
- interpretations: [, output.headers["x-amz-lex-interpretations"]],
379
- sessionState: [, output.headers["x-amz-lex-session-state"]],
380
- requestAttributes: [, output.headers["x-amz-lex-request-attributes"]],
381
- sessionId: [, output.headers["x-amz-lex-session-id"]],
382
- inputTranscript: [, output.headers["x-amz-lex-input-transcript"]],
383
- recognizedBotMember: [, output.headers["x-amz-lex-recognized-bot-member"]],
327
+ [_iM]: [, output.headers[_xalim]],
328
+ [_cT]: [, output.headers[_ct]],
329
+ [_m]: [, output.headers[_xalm]],
330
+ [_i]: [, output.headers[_xali]],
331
+ [_sS]: [, output.headers[_xalss]],
332
+ [_rA]: [, output.headers[_xalra]],
333
+ [_sI]: [, output.headers[_xalsi]],
334
+ [_iT]: [, output.headers[_xalit]],
335
+ [_rBM]: [, output.headers[_xalrbm]],
384
336
  });
385
337
  const data = output.body;
386
338
  context.sdkStreamMixin(data);
@@ -1071,6 +1023,30 @@ const isSerializableHeaderValue = (value) => value !== undefined &&
1071
1023
  value !== "" &&
1072
1024
  (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
1073
1025
  (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
1026
+ const _cM = "conversationMode";
1027
+ const _cT = "contentType";
1028
+ const _ct = "content-type";
1029
+ const _i = "interpretations";
1030
+ const _iM = "inputMode";
1031
+ const _iT = "inputTranscript";
1032
+ const _m = "messages";
1033
+ const _r = "responsecontenttype";
1034
+ const _rA = "requestAttributes";
1035
+ const _rBM = "recognizedBotMember";
1036
+ const _rCT = "responseContentType";
1037
+ const _rCTe = "requestContentType";
1038
+ const _rct = "response-content-type";
1039
+ const _sI = "sessionId";
1040
+ const _sS = "sessionState";
1041
+ const _xalcm = "x-amz-lex-conversation-mode";
1042
+ const _xali = "x-amz-lex-interpretations";
1043
+ const _xalim = "x-amz-lex-input-mode";
1044
+ const _xalit = "x-amz-lex-input-transcript";
1045
+ const _xalm = "x-amz-lex-messages";
1046
+ const _xalra = "x-amz-lex-request-attributes";
1047
+ const _xalrbm = "x-amz-lex-recognized-bot-member";
1048
+ const _xalsi = "x-amz-lex-session-id";
1049
+ const _xalss = "x-amz-lex-session-state";
1074
1050
  const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
1075
1051
  if (encoded.length) {
1076
1052
  return JSON.parse(encoded);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-lex-runtime-v2",
3
3
  "description": "AWS SDK for JavaScript Lex Runtime V2 Client for Node.js, Browser and React Native",
4
- "version": "3.476.0",
4
+ "version": "3.477.0",
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",
@@ -20,9 +20,9 @@
20
20
  "dependencies": {
21
21
  "@aws-crypto/sha256-browser": "3.0.0",
22
22
  "@aws-crypto/sha256-js": "3.0.0",
23
- "@aws-sdk/client-sts": "3.476.0",
24
- "@aws-sdk/core": "3.476.0",
25
- "@aws-sdk/credential-provider-node": "3.476.0",
23
+ "@aws-sdk/client-sts": "3.477.0",
24
+ "@aws-sdk/core": "3.477.0",
25
+ "@aws-sdk/credential-provider-node": "3.477.0",
26
26
  "@aws-sdk/eventstream-handler-node": "3.468.0",
27
27
  "@aws-sdk/middleware-eventstream": "3.468.0",
28
28
  "@aws-sdk/middleware-host-header": "3.468.0",
@@ -36,6 +36,7 @@
36
36
  "@aws-sdk/util-user-agent-browser": "3.468.0",
37
37
  "@aws-sdk/util-user-agent-node": "3.470.0",
38
38
  "@smithy/config-resolver": "^2.0.21",
39
+ "@smithy/core": "^1.2.0",
39
40
  "@smithy/eventstream-serde-browser": "^2.0.15",
40
41
  "@smithy/eventstream-serde-config-resolver": "^2.0.15",
41
42
  "@smithy/eventstream-serde-node": "^2.0.15",