|
| 1 | +// smithy-typescript generated code |
| 2 | +import { EndpointParameterInstructions, getEndpointPlugin } from "@smithy/middleware-endpoint"; |
| 3 | +import { getSerdePlugin } from "@smithy/middleware-serde"; |
| 4 | +import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http"; |
| 5 | +import { Command as $Command } from "@smithy/smithy-client"; |
| 6 | +import { |
| 7 | + FinalizeHandlerArguments, |
| 8 | + Handler, |
| 9 | + HandlerExecutionContext, |
| 10 | + HttpHandlerOptions as __HttpHandlerOptions, |
| 11 | + MetadataBearer as __MetadataBearer, |
| 12 | + MiddlewareStack, |
| 13 | + SerdeContext as __SerdeContext, |
| 14 | + SMITHY_CONTEXT_KEY, |
| 15 | +} from "@smithy/types"; |
| 16 | + |
| 17 | +import { |
| 18 | + GetActionRecommendationsRequest, |
| 19 | + GetActionRecommendationsRequestFilterSensitiveLog, |
| 20 | + GetActionRecommendationsResponse, |
| 21 | +} from "../models/models_0"; |
| 22 | +import { |
| 23 | + PersonalizeRuntimeClientResolvedConfig, |
| 24 | + ServiceInputTypes, |
| 25 | + ServiceOutputTypes, |
| 26 | +} from "../PersonalizeRuntimeClient"; |
| 27 | +import { de_GetActionRecommendationsCommand, se_GetActionRecommendationsCommand } from "../protocols/Aws_restJson1"; |
| 28 | + |
| 29 | +/** |
| 30 | + * @public |
| 31 | + */ |
| 32 | +export { __MetadataBearer, $Command }; |
| 33 | +/** |
| 34 | + * @public |
| 35 | + * |
| 36 | + * The input for {@link GetActionRecommendationsCommand}. |
| 37 | + */ |
| 38 | +export interface GetActionRecommendationsCommandInput extends GetActionRecommendationsRequest {} |
| 39 | +/** |
| 40 | + * @public |
| 41 | + * |
| 42 | + * The output of {@link GetActionRecommendationsCommand}. |
| 43 | + */ |
| 44 | +export interface GetActionRecommendationsCommandOutput extends GetActionRecommendationsResponse, __MetadataBearer {} |
| 45 | + |
| 46 | +/** |
| 47 | + * @public |
| 48 | + * <p>Returns a list of recommended actions in sorted in descending order by prediction score. |
| 49 | + * Use the <code>GetActionRecommendations</code> API if you have a custom |
| 50 | + * campaign that deploys a solution version trained with a PERSONALIZED_ACTIONS recipe. |
| 51 | + * </p> |
| 52 | + * <p>For more information about PERSONALIZED_ACTIONS recipes, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/nexts-best-action-recipes.html">PERSONALIZED_ACTIONS recipes</a>. |
| 53 | + * For more information about getting action recommendations, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/get-action-recommendations.html">Getting action recommendations</a>.</p> |
| 54 | + * @example |
| 55 | + * Use a bare-bones client and the command you need to make an API call. |
| 56 | + * ```javascript |
| 57 | + * import { PersonalizeRuntimeClient, GetActionRecommendationsCommand } from "@aws-sdk/client-personalize-runtime"; // ES Modules import |
| 58 | + * // const { PersonalizeRuntimeClient, GetActionRecommendationsCommand } = require("@aws-sdk/client-personalize-runtime"); // CommonJS import |
| 59 | + * const client = new PersonalizeRuntimeClient(config); |
| 60 | + * const input = { // GetActionRecommendationsRequest |
| 61 | + * campaignArn: "STRING_VALUE", |
| 62 | + * userId: "STRING_VALUE", |
| 63 | + * numResults: Number("int"), |
| 64 | + * filterArn: "STRING_VALUE", |
| 65 | + * filterValues: { // FilterValues |
| 66 | + * "<keys>": "STRING_VALUE", |
| 67 | + * }, |
| 68 | + * }; |
| 69 | + * const command = new GetActionRecommendationsCommand(input); |
| 70 | + * const response = await client.send(command); |
| 71 | + * // { // GetActionRecommendationsResponse |
| 72 | + * // actionList: [ // ActionList |
| 73 | + * // { // PredictedAction |
| 74 | + * // actionId: "STRING_VALUE", |
| 75 | + * // score: Number("double"), |
| 76 | + * // }, |
| 77 | + * // ], |
| 78 | + * // recommendationId: "STRING_VALUE", |
| 79 | + * // }; |
| 80 | + * |
| 81 | + * ``` |
| 82 | + * |
| 83 | + * @param GetActionRecommendationsCommandInput - {@link GetActionRecommendationsCommandInput} |
| 84 | + * @returns {@link GetActionRecommendationsCommandOutput} |
| 85 | + * @see {@link GetActionRecommendationsCommandInput} for command's `input` shape. |
| 86 | + * @see {@link GetActionRecommendationsCommandOutput} for command's `response` shape. |
| 87 | + * @see {@link PersonalizeRuntimeClientResolvedConfig | config} for PersonalizeRuntimeClient's `config` shape. |
| 88 | + * |
| 89 | + * @throws {@link InvalidInputException} (client fault) |
| 90 | + * <p>Provide a valid value for the field or parameter.</p> |
| 91 | + * |
| 92 | + * @throws {@link ResourceNotFoundException} (client fault) |
| 93 | + * <p>The specified resource does not exist.</p> |
| 94 | + * |
| 95 | + * @throws {@link PersonalizeRuntimeServiceException} |
| 96 | + * <p>Base exception class for all service exceptions from PersonalizeRuntime service.</p> |
| 97 | + * |
| 98 | + */ |
| 99 | +export class GetActionRecommendationsCommand extends $Command< |
| 100 | + GetActionRecommendationsCommandInput, |
| 101 | + GetActionRecommendationsCommandOutput, |
| 102 | + PersonalizeRuntimeClientResolvedConfig |
| 103 | +> { |
| 104 | + public static getEndpointParameterInstructions(): EndpointParameterInstructions { |
| 105 | + return { |
| 106 | + UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, |
| 107 | + Endpoint: { type: "builtInParams", name: "endpoint" }, |
| 108 | + Region: { type: "builtInParams", name: "region" }, |
| 109 | + UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }, |
| 110 | + }; |
| 111 | + } |
| 112 | + |
| 113 | + /** |
| 114 | + * @public |
| 115 | + */ |
| 116 | + constructor(readonly input: GetActionRecommendationsCommandInput) { |
| 117 | + super(); |
| 118 | + } |
| 119 | + |
| 120 | + /** |
| 121 | + * @internal |
| 122 | + */ |
| 123 | + resolveMiddleware( |
| 124 | + clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, |
| 125 | + configuration: PersonalizeRuntimeClientResolvedConfig, |
| 126 | + options?: __HttpHandlerOptions |
| 127 | + ): Handler<GetActionRecommendationsCommandInput, GetActionRecommendationsCommandOutput> { |
| 128 | + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); |
| 129 | + this.middlewareStack.use( |
| 130 | + getEndpointPlugin(configuration, GetActionRecommendationsCommand.getEndpointParameterInstructions()) |
| 131 | + ); |
| 132 | + |
| 133 | + const stack = clientStack.concat(this.middlewareStack); |
| 134 | + |
| 135 | + const { logger } = configuration; |
| 136 | + const clientName = "PersonalizeRuntimeClient"; |
| 137 | + const commandName = "GetActionRecommendationsCommand"; |
| 138 | + const handlerExecutionContext: HandlerExecutionContext = { |
| 139 | + logger, |
| 140 | + clientName, |
| 141 | + commandName, |
| 142 | + inputFilterSensitiveLog: GetActionRecommendationsRequestFilterSensitiveLog, |
| 143 | + outputFilterSensitiveLog: (_: any) => _, |
| 144 | + [SMITHY_CONTEXT_KEY]: { |
| 145 | + service: "AmazonPersonalizeRuntime", |
| 146 | + operation: "GetActionRecommendations", |
| 147 | + }, |
| 148 | + }; |
| 149 | + const { requestHandler } = configuration; |
| 150 | + return stack.resolve( |
| 151 | + (request: FinalizeHandlerArguments<any>) => |
| 152 | + requestHandler.handle(request.request as __HttpRequest, options || {}), |
| 153 | + handlerExecutionContext |
| 154 | + ); |
| 155 | + } |
| 156 | + |
| 157 | + /** |
| 158 | + * @internal |
| 159 | + */ |
| 160 | + private serialize(input: GetActionRecommendationsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { |
| 161 | + return se_GetActionRecommendationsCommand(input, context); |
| 162 | + } |
| 163 | + |
| 164 | + /** |
| 165 | + * @internal |
| 166 | + */ |
| 167 | + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<GetActionRecommendationsCommandOutput> { |
| 168 | + return de_GetActionRecommendationsCommand(output, context); |
| 169 | + } |
| 170 | +} |
0 commit comments