|
| 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 { PutFeedbackRequest, PutFeedbackResponse } from "../models/models_0"; |
| 18 | +import { de_PutFeedbackCommand, se_PutFeedbackCommand } from "../protocols/Aws_restJson1"; |
| 19 | +import { QConnectClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QConnectClient"; |
| 20 | + |
| 21 | +/** |
| 22 | + * @public |
| 23 | + */ |
| 24 | +export { __MetadataBearer, $Command }; |
| 25 | +/** |
| 26 | + * @public |
| 27 | + * |
| 28 | + * The input for {@link PutFeedbackCommand}. |
| 29 | + */ |
| 30 | +export interface PutFeedbackCommandInput extends PutFeedbackRequest {} |
| 31 | +/** |
| 32 | + * @public |
| 33 | + * |
| 34 | + * The output of {@link PutFeedbackCommand}. |
| 35 | + */ |
| 36 | +export interface PutFeedbackCommandOutput extends PutFeedbackResponse, __MetadataBearer {} |
| 37 | + |
| 38 | +/** |
| 39 | + * @public |
| 40 | + * <p>Provides feedback against the specified assistant for the specified target. This API only supports generative targets.</p> |
| 41 | + * @example |
| 42 | + * Use a bare-bones client and the command you need to make an API call. |
| 43 | + * ```javascript |
| 44 | + * import { QConnectClient, PutFeedbackCommand } from "@aws-sdk/client-qconnect"; // ES Modules import |
| 45 | + * // const { QConnectClient, PutFeedbackCommand } = require("@aws-sdk/client-qconnect"); // CommonJS import |
| 46 | + * const client = new QConnectClient(config); |
| 47 | + * const input = { // PutFeedbackRequest |
| 48 | + * assistantId: "STRING_VALUE", // required |
| 49 | + * targetId: "STRING_VALUE", // required |
| 50 | + * targetType: "STRING_VALUE", // required |
| 51 | + * contentFeedback: { // ContentFeedbackData Union: only one key present |
| 52 | + * generativeContentFeedbackData: { // GenerativeContentFeedbackData |
| 53 | + * relevance: "STRING_VALUE", // required |
| 54 | + * }, |
| 55 | + * }, |
| 56 | + * }; |
| 57 | + * const command = new PutFeedbackCommand(input); |
| 58 | + * const response = await client.send(command); |
| 59 | + * // { // PutFeedbackResponse |
| 60 | + * // assistantId: "STRING_VALUE", // required |
| 61 | + * // assistantArn: "STRING_VALUE", // required |
| 62 | + * // targetId: "STRING_VALUE", // required |
| 63 | + * // targetType: "STRING_VALUE", // required |
| 64 | + * // contentFeedback: { // ContentFeedbackData Union: only one key present |
| 65 | + * // generativeContentFeedbackData: { // GenerativeContentFeedbackData |
| 66 | + * // relevance: "STRING_VALUE", // required |
| 67 | + * // }, |
| 68 | + * // }, |
| 69 | + * // }; |
| 70 | + * |
| 71 | + * ``` |
| 72 | + * |
| 73 | + * @param PutFeedbackCommandInput - {@link PutFeedbackCommandInput} |
| 74 | + * @returns {@link PutFeedbackCommandOutput} |
| 75 | + * @see {@link PutFeedbackCommandInput} for command's `input` shape. |
| 76 | + * @see {@link PutFeedbackCommandOutput} for command's `response` shape. |
| 77 | + * @see {@link QConnectClientResolvedConfig | config} for QConnectClient's `config` shape. |
| 78 | + * |
| 79 | + * @throws {@link AccessDeniedException} (client fault) |
| 80 | + * <p>You do not have sufficient access to perform this action.</p> |
| 81 | + * |
| 82 | + * @throws {@link ResourceNotFoundException} (client fault) |
| 83 | + * <p>The specified resource does not exist.</p> |
| 84 | + * |
| 85 | + * @throws {@link ValidationException} (client fault) |
| 86 | + * <p>The input fails to satisfy the constraints specified by a service.</p> |
| 87 | + * |
| 88 | + * @throws {@link QConnectServiceException} |
| 89 | + * <p>Base exception class for all service exceptions from QConnect service.</p> |
| 90 | + * |
| 91 | + */ |
| 92 | +export class PutFeedbackCommand extends $Command< |
| 93 | + PutFeedbackCommandInput, |
| 94 | + PutFeedbackCommandOutput, |
| 95 | + QConnectClientResolvedConfig |
| 96 | +> { |
| 97 | + public static getEndpointParameterInstructions(): EndpointParameterInstructions { |
| 98 | + return { |
| 99 | + UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, |
| 100 | + Endpoint: { type: "builtInParams", name: "endpoint" }, |
| 101 | + Region: { type: "builtInParams", name: "region" }, |
| 102 | + UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }, |
| 103 | + }; |
| 104 | + } |
| 105 | + |
| 106 | + /** |
| 107 | + * @public |
| 108 | + */ |
| 109 | + constructor(readonly input: PutFeedbackCommandInput) { |
| 110 | + super(); |
| 111 | + } |
| 112 | + |
| 113 | + /** |
| 114 | + * @internal |
| 115 | + */ |
| 116 | + resolveMiddleware( |
| 117 | + clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, |
| 118 | + configuration: QConnectClientResolvedConfig, |
| 119 | + options?: __HttpHandlerOptions |
| 120 | + ): Handler<PutFeedbackCommandInput, PutFeedbackCommandOutput> { |
| 121 | + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); |
| 122 | + this.middlewareStack.use(getEndpointPlugin(configuration, PutFeedbackCommand.getEndpointParameterInstructions())); |
| 123 | + |
| 124 | + const stack = clientStack.concat(this.middlewareStack); |
| 125 | + |
| 126 | + const { logger } = configuration; |
| 127 | + const clientName = "QConnectClient"; |
| 128 | + const commandName = "PutFeedbackCommand"; |
| 129 | + const handlerExecutionContext: HandlerExecutionContext = { |
| 130 | + logger, |
| 131 | + clientName, |
| 132 | + commandName, |
| 133 | + inputFilterSensitiveLog: (_: any) => _, |
| 134 | + outputFilterSensitiveLog: (_: any) => _, |
| 135 | + [SMITHY_CONTEXT_KEY]: { |
| 136 | + service: "WisdomService", |
| 137 | + operation: "PutFeedback", |
| 138 | + }, |
| 139 | + }; |
| 140 | + const { requestHandler } = configuration; |
| 141 | + return stack.resolve( |
| 142 | + (request: FinalizeHandlerArguments<any>) => |
| 143 | + requestHandler.handle(request.request as __HttpRequest, options || {}), |
| 144 | + handlerExecutionContext |
| 145 | + ); |
| 146 | + } |
| 147 | + |
| 148 | + /** |
| 149 | + * @internal |
| 150 | + */ |
| 151 | + private serialize(input: PutFeedbackCommandInput, context: __SerdeContext): Promise<__HttpRequest> { |
| 152 | + return se_PutFeedbackCommand(input, context); |
| 153 | + } |
| 154 | + |
| 155 | + /** |
| 156 | + * @internal |
| 157 | + */ |
| 158 | + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<PutFeedbackCommandOutput> { |
| 159 | + return de_PutFeedbackCommand(output, context); |
| 160 | + } |
| 161 | +} |
0 commit comments