UNPKG

@aws-sdk/client-lex-runtime-service

Version:

AWS SDK for JavaScript Lex Runtime Service Client for Node.js, Browser and React Native

229 lines (203 loc) 7.46 kB
import { DeleteSessionCommandInput, DeleteSessionCommandOutput } from "./commands/DeleteSessionCommand"; import { GetSessionCommandInput, GetSessionCommandOutput } from "./commands/GetSessionCommand"; import { PostContentCommandInput, PostContentCommandOutput } from "./commands/PostContentCommand"; import { PostTextCommandInput, PostTextCommandOutput } from "./commands/PostTextCommand"; import { PutSessionCommandInput, PutSessionCommandOutput } from "./commands/PutSessionCommand"; import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, RegionInputConfig, RegionResolvedConfig, resolveEndpointsConfig, resolveRegionConfig, } from "@aws-sdk/config-resolver"; import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length"; import { HostHeaderInputConfig, HostHeaderResolvedConfig, getHostHeaderPlugin, resolveHostHeaderConfig, } from "@aws-sdk/middleware-host-header"; import { getLoggerPlugin } from "@aws-sdk/middleware-logger"; import { RetryInputConfig, RetryResolvedConfig, getRetryPlugin, resolveRetryConfig } from "@aws-sdk/middleware-retry"; import { AwsAuthInputConfig, AwsAuthResolvedConfig, getAwsAuthPlugin, resolveAwsAuthConfig, } from "@aws-sdk/middleware-signing"; import { UserAgentInputConfig, UserAgentResolvedConfig, getUserAgentPlugin, resolveUserAgentConfig, } from "@aws-sdk/middleware-user-agent"; import { HttpHandler as __HttpHandler } from "@aws-sdk/protocol-http"; import { Client as __Client, SmithyConfiguration as __SmithyConfiguration, SmithyResolvedConfiguration as __SmithyResolvedConfiguration, } from "@aws-sdk/smithy-client"; import { Provider, RegionInfoProvider, Credentials as __Credentials, Decoder as __Decoder, Encoder as __Encoder, HashConstructor as __HashConstructor, HttpHandlerOptions as __HttpHandlerOptions, Logger as __Logger, Provider as __Provider, StreamCollector as __StreamCollector, UrlParser as __UrlParser, UserAgent as __UserAgent, } from "@aws-sdk/types"; export type ServiceInputTypes = | DeleteSessionCommandInput | GetSessionCommandInput | PostContentCommandInput | PostTextCommandInput | PutSessionCommandInput; export type ServiceOutputTypes = | DeleteSessionCommandOutput | GetSessionCommandOutput | PostContentCommandOutput | PostTextCommandOutput | PutSessionCommandOutput; export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> { /** * The HTTP handler to use. Fetch in browser and Https in Nodejs. */ requestHandler?: __HttpHandler; /** * A constructor for a class implementing the @aws-sdk/types.Hash interface * that computes the SHA-256 HMAC or checksum of a string or binary buffer. */ sha256?: __HashConstructor; /** * The function that will be used to convert strings into HTTP endpoints. */ urlParser?: __UrlParser; /** * A function that can calculate the length of a request body. */ bodyLengthChecker?: (body: any) => number | undefined; /** * A function that converts a stream into an array of bytes. */ streamCollector?: __StreamCollector; /** * The function that will be used to convert a base64-encoded string to a byte array */ base64Decoder?: __Decoder; /** * The function that will be used to convert binary data to a base64-encoded string */ base64Encoder?: __Encoder; /** * The function that will be used to convert a UTF8-encoded string to a byte array */ utf8Decoder?: __Decoder; /** * The function that will be used to convert binary data to a UTF-8 encoded string */ utf8Encoder?: __Encoder; /** * The runtime environment */ runtime?: string; /** * Disable dyanamically changing the endpoint of the client based on the hostPrefix * trait of an operation. */ disableHostPrefix?: boolean; /** * Unique service identifier. * @internal */ serviceId?: string; /** * The AWS region to which this client will send requests */ region?: string | __Provider<string>; /** * Value for how many times a request will be made at most in case of retry. */ maxAttempts?: number | __Provider<number>; /** * Optional logger for logging debug/info/warn/error. */ logger?: __Logger; /** * Default credentials provider; Not available in browser runtime. */ credentialDefaultProvider?: (input: any) => __Provider<__Credentials>; /** * Fetch related hostname, signing name or signing region with given region. */ regionInfoProvider?: RegionInfoProvider; /** * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header * @internal */ defaultUserAgentProvider?: Provider<__UserAgent>; } export type LexRuntimeServiceClientConfig = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & ClientDefaults & RegionInputConfig & EndpointsInputConfig & RetryInputConfig & HostHeaderInputConfig & AwsAuthInputConfig & UserAgentInputConfig; export type LexRuntimeServiceClientResolvedConfig = __SmithyResolvedConfiguration<__HttpHandlerOptions> & Required<ClientDefaults> & RegionResolvedConfig & EndpointsResolvedConfig & RetryResolvedConfig & HostHeaderResolvedConfig & AwsAuthResolvedConfig & UserAgentResolvedConfig; /** * <p>Amazon Lex provides both build and runtime endpoints. Each endpoint provides a set of * operations (API). Your conversational bot uses the runtime API to understand user utterances * (user input text or voice). For example, suppose a user says "I want pizza", your bot sends * this input to Amazon Lex using the runtime API. Amazon Lex recognizes that the user request is * for the OrderPizza intent (one of the intents defined in the bot). Then Amazon Lex engages in * user conversation on behalf of the bot to elicit required information (slot values, such as * pizza size and crust type), and then performs fulfillment activity (that you configured when * you created the bot). You use the build-time API to create and manage your Amazon Lex bot. For * a list of build-time operations, see the build-time API, . </p> */ export class LexRuntimeServiceClient extends __Client< __HttpHandlerOptions, ServiceInputTypes, ServiceOutputTypes, LexRuntimeServiceClientResolvedConfig > { readonly config: LexRuntimeServiceClientResolvedConfig; constructor(configuration: LexRuntimeServiceClientConfig) { let _config_0 = { ...__ClientDefaultValues, ...configuration, }; let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); let _config_4 = resolveHostHeaderConfig(_config_3); let _config_5 = resolveAwsAuthConfig(_config_4); let _config_6 = resolveUserAgentConfig(_config_5); super(_config_6); this.config = _config_6; this.middlewareStack.use(getRetryPlugin(this.config)); this.middlewareStack.use(getContentLengthPlugin(this.config)); this.middlewareStack.use(getHostHeaderPlugin(this.config)); this.middlewareStack.use(getLoggerPlugin(this.config)); this.middlewareStack.use(getAwsAuthPlugin(this.config)); this.middlewareStack.use(getUserAgentPlugin(this.config)); } destroy(): void { super.destroy(); } }