@aws-sdk/client-personalize-runtime 3.928.0 → 3.930.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,195 +0,0 @@
1
- import { loadRestJsonErrorCode, parseJsonBody as parseBody, parseJsonErrorBody as parseErrorBody } from "@aws-sdk/core";
2
- import { requestBuilder as rb } from "@smithy/core";
3
- 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";
4
- import { InvalidInputException, ResourceNotFoundException, } from "../models/models_0";
5
- import { PersonalizeRuntimeServiceException as __BaseException } from "../models/PersonalizeRuntimeServiceException";
6
- export const se_GetActionRecommendationsCommand = async (input, context) => {
7
- const b = rb(input, context);
8
- const headers = {
9
- "content-type": "application/json",
10
- };
11
- b.bp("/action-recommendations");
12
- let body;
13
- body = JSON.stringify(take(input, {
14
- campaignArn: [],
15
- filterArn: [],
16
- filterValues: (_) => _json(_),
17
- numResults: [],
18
- userId: [],
19
- }));
20
- b.m("POST").h(headers).b(body);
21
- return b.build();
22
- };
23
- export const se_GetPersonalizedRankingCommand = async (input, context) => {
24
- const b = rb(input, context);
25
- const headers = {
26
- "content-type": "application/json",
27
- };
28
- b.bp("/personalize-ranking");
29
- let body;
30
- body = JSON.stringify(take(input, {
31
- campaignArn: [],
32
- context: (_) => _json(_),
33
- filterArn: [],
34
- filterValues: (_) => _json(_),
35
- inputList: (_) => _json(_),
36
- metadataColumns: (_) => _json(_),
37
- userId: [],
38
- }));
39
- b.m("POST").h(headers).b(body);
40
- return b.build();
41
- };
42
- export const se_GetRecommendationsCommand = async (input, context) => {
43
- const b = rb(input, context);
44
- const headers = {
45
- "content-type": "application/json",
46
- };
47
- b.bp("/recommendations");
48
- let body;
49
- body = JSON.stringify(take(input, {
50
- campaignArn: [],
51
- context: (_) => _json(_),
52
- filterArn: [],
53
- filterValues: (_) => _json(_),
54
- itemId: [],
55
- metadataColumns: (_) => _json(_),
56
- numResults: [],
57
- promotions: (_) => _json(_),
58
- recommenderArn: [],
59
- userId: [],
60
- }));
61
- b.m("POST").h(headers).b(body);
62
- return b.build();
63
- };
64
- export const de_GetActionRecommendationsCommand = async (output, context) => {
65
- if (output.statusCode !== 200 && output.statusCode >= 300) {
66
- return de_CommandError(output, context);
67
- }
68
- const contents = map({
69
- $metadata: deserializeMetadata(output),
70
- });
71
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
72
- const doc = take(data, {
73
- actionList: (_) => de_ActionList(_, context),
74
- recommendationId: __expectString,
75
- });
76
- Object.assign(contents, doc);
77
- return contents;
78
- };
79
- export const de_GetPersonalizedRankingCommand = async (output, context) => {
80
- if (output.statusCode !== 200 && output.statusCode >= 300) {
81
- return de_CommandError(output, context);
82
- }
83
- const contents = map({
84
- $metadata: deserializeMetadata(output),
85
- });
86
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
87
- const doc = take(data, {
88
- personalizedRanking: (_) => de_ItemList(_, context),
89
- recommendationId: __expectString,
90
- });
91
- Object.assign(contents, doc);
92
- return contents;
93
- };
94
- export const de_GetRecommendationsCommand = async (output, context) => {
95
- if (output.statusCode !== 200 && output.statusCode >= 300) {
96
- return de_CommandError(output, context);
97
- }
98
- const contents = map({
99
- $metadata: deserializeMetadata(output),
100
- });
101
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
102
- const doc = take(data, {
103
- itemList: (_) => de_ItemList(_, context),
104
- recommendationId: __expectString,
105
- });
106
- Object.assign(contents, doc);
107
- return contents;
108
- };
109
- const de_CommandError = async (output, context) => {
110
- const parsedOutput = {
111
- ...output,
112
- body: await parseErrorBody(output.body, context),
113
- };
114
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
115
- switch (errorCode) {
116
- case "InvalidInputException":
117
- case "com.amazonaws.personalizeruntime#InvalidInputException":
118
- throw await de_InvalidInputExceptionRes(parsedOutput, context);
119
- case "ResourceNotFoundException":
120
- case "com.amazonaws.personalizeruntime#ResourceNotFoundException":
121
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
122
- default:
123
- const parsedBody = parsedOutput.body;
124
- return throwDefaultError({
125
- output,
126
- parsedBody,
127
- errorCode,
128
- });
129
- }
130
- };
131
- const throwDefaultError = withBaseException(__BaseException);
132
- const de_InvalidInputExceptionRes = async (parsedOutput, context) => {
133
- const contents = map({});
134
- const data = parsedOutput.body;
135
- const doc = take(data, {
136
- message: __expectString,
137
- });
138
- Object.assign(contents, doc);
139
- const exception = new InvalidInputException({
140
- $metadata: deserializeMetadata(parsedOutput),
141
- ...contents,
142
- });
143
- return __decorateServiceException(exception, parsedOutput.body);
144
- };
145
- const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
146
- const contents = map({});
147
- const data = parsedOutput.body;
148
- const doc = take(data, {
149
- message: __expectString,
150
- });
151
- Object.assign(contents, doc);
152
- const exception = new ResourceNotFoundException({
153
- $metadata: deserializeMetadata(parsedOutput),
154
- ...contents,
155
- });
156
- return __decorateServiceException(exception, parsedOutput.body);
157
- };
158
- const de_ActionList = (output, context) => {
159
- const retVal = (output || [])
160
- .filter((e) => e != null)
161
- .map((entry) => {
162
- return de_PredictedAction(entry, context);
163
- });
164
- return retVal;
165
- };
166
- const de_ItemList = (output, context) => {
167
- const retVal = (output || [])
168
- .filter((e) => e != null)
169
- .map((entry) => {
170
- return de_PredictedItem(entry, context);
171
- });
172
- return retVal;
173
- };
174
- const de_PredictedAction = (output, context) => {
175
- return take(output, {
176
- actionId: __expectString,
177
- score: __limitedParseDouble,
178
- });
179
- };
180
- const de_PredictedItem = (output, context) => {
181
- return take(output, {
182
- itemId: __expectString,
183
- metadata: _json,
184
- promotionName: __expectString,
185
- reason: _json,
186
- score: __limitedParseDouble,
187
- });
188
- };
189
- const deserializeMetadata = (output) => ({
190
- httpStatusCode: output.statusCode,
191
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
192
- extendedRequestId: output.headers["x-amz-id-2"],
193
- cfId: output.headers["x-amz-cf-id"],
194
- });
195
- const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
@@ -1,29 +0,0 @@
1
- import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
2
- import { SerdeContext as __SerdeContext } from "@smithy/types";
3
- import { GetActionRecommendationsCommandInput, GetActionRecommendationsCommandOutput } from "../commands/GetActionRecommendationsCommand";
4
- import { GetPersonalizedRankingCommandInput, GetPersonalizedRankingCommandOutput } from "../commands/GetPersonalizedRankingCommand";
5
- import { GetRecommendationsCommandInput, GetRecommendationsCommandOutput } from "../commands/GetRecommendationsCommand";
6
- /**
7
- * serializeAws_restJson1GetActionRecommendationsCommand
8
- */
9
- export declare const se_GetActionRecommendationsCommand: (input: GetActionRecommendationsCommandInput, context: __SerdeContext) => Promise<__HttpRequest>;
10
- /**
11
- * serializeAws_restJson1GetPersonalizedRankingCommand
12
- */
13
- export declare const se_GetPersonalizedRankingCommand: (input: GetPersonalizedRankingCommandInput, context: __SerdeContext) => Promise<__HttpRequest>;
14
- /**
15
- * serializeAws_restJson1GetRecommendationsCommand
16
- */
17
- export declare const se_GetRecommendationsCommand: (input: GetRecommendationsCommandInput, context: __SerdeContext) => Promise<__HttpRequest>;
18
- /**
19
- * deserializeAws_restJson1GetActionRecommendationsCommand
20
- */
21
- export declare const de_GetActionRecommendationsCommand: (output: __HttpResponse, context: __SerdeContext) => Promise<GetActionRecommendationsCommandOutput>;
22
- /**
23
- * deserializeAws_restJson1GetPersonalizedRankingCommand
24
- */
25
- export declare const de_GetPersonalizedRankingCommand: (output: __HttpResponse, context: __SerdeContext) => Promise<GetPersonalizedRankingCommandOutput>;
26
- /**
27
- * deserializeAws_restJson1GetRecommendationsCommand
28
- */
29
- export declare const de_GetRecommendationsCommand: (output: __HttpResponse, context: __SerdeContext) => Promise<GetRecommendationsCommandOutput>;
@@ -1,41 +0,0 @@
1
- import {
2
- HttpRequest as __HttpRequest,
3
- HttpResponse as __HttpResponse,
4
- } from "@smithy/protocol-http";
5
- import { SerdeContext as __SerdeContext } from "@smithy/types";
6
- import {
7
- GetActionRecommendationsCommandInput,
8
- GetActionRecommendationsCommandOutput,
9
- } from "../commands/GetActionRecommendationsCommand";
10
- import {
11
- GetPersonalizedRankingCommandInput,
12
- GetPersonalizedRankingCommandOutput,
13
- } from "../commands/GetPersonalizedRankingCommand";
14
- import {
15
- GetRecommendationsCommandInput,
16
- GetRecommendationsCommandOutput,
17
- } from "../commands/GetRecommendationsCommand";
18
- export declare const se_GetActionRecommendationsCommand: (
19
- input: GetActionRecommendationsCommandInput,
20
- context: __SerdeContext
21
- ) => Promise<__HttpRequest>;
22
- export declare const se_GetPersonalizedRankingCommand: (
23
- input: GetPersonalizedRankingCommandInput,
24
- context: __SerdeContext
25
- ) => Promise<__HttpRequest>;
26
- export declare const se_GetRecommendationsCommand: (
27
- input: GetRecommendationsCommandInput,
28
- context: __SerdeContext
29
- ) => Promise<__HttpRequest>;
30
- export declare const de_GetActionRecommendationsCommand: (
31
- output: __HttpResponse,
32
- context: __SerdeContext
33
- ) => Promise<GetActionRecommendationsCommandOutput>;
34
- export declare const de_GetPersonalizedRankingCommand: (
35
- output: __HttpResponse,
36
- context: __SerdeContext
37
- ) => Promise<GetPersonalizedRankingCommandOutput>;
38
- export declare const de_GetRecommendationsCommand: (
39
- output: __HttpResponse,
40
- context: __SerdeContext
41
- ) => Promise<GetRecommendationsCommandOutput>;