Documentation ¶
Overview ¶
Package lexruntimev2 provides the API client, operations, and parameter types for Amazon Lex Runtime V2.
Index ¶
- Constants
- func NewDefaultEndpointResolver() *internalendpoints.Resolver
- func WithAPIOptions(optFns ...func(*middleware.Stack) error) func(*Options)
- func WithEndpointResolver(v EndpointResolver) func(*Options)
- type Client
- func (c *Client) DeleteSession(ctx context.Context, params *DeleteSessionInput, optFns ...func(*Options)) (*DeleteSessionOutput, error)
- func (c *Client) GetSession(ctx context.Context, params *GetSessionInput, optFns ...func(*Options)) (*GetSessionOutput, error)
- func (c *Client) PutSession(ctx context.Context, params *PutSessionInput, optFns ...func(*Options)) (*PutSessionOutput, error)
- func (c *Client) RecognizeText(ctx context.Context, params *RecognizeTextInput, optFns ...func(*Options)) (*RecognizeTextOutput, error)
- func (c *Client) RecognizeUtterance(ctx context.Context, params *RecognizeUtteranceInput, optFns ...func(*Options)) (*RecognizeUtteranceOutput, error)
- func (c *Client) StartConversation(ctx context.Context, params *StartConversationInput, optFns ...func(*Options)) (*StartConversationOutput, error)
- type DeleteSessionInput
- type DeleteSessionOutput
- type EndpointResolver
- type EndpointResolverFunc
- type EndpointResolverOptions
- type GetSessionInput
- type GetSessionOutput
- type HTTPClient
- type HTTPSignerV4
- type Options
- type PutSessionInput
- type PutSessionOutput
- type RecognizeTextInput
- type RecognizeTextOutput
- type RecognizeUtteranceInput
- type RecognizeUtteranceOutput
- type ResolveEndpoint
- type StartConversationEventStream
- func (es *StartConversationEventStream) Close() error
- func (es *StartConversationEventStream) Err() error
- func (es *StartConversationEventStream) Events() <-chan types.StartConversationResponseEventStream
- func (es *StartConversationEventStream) Send(ctx context.Context, event types.StartConversationRequestEventStream) error
- type StartConversationInput
- type StartConversationOutput
- type StartConversationRequestEventStreamWriter
- type StartConversationResponseEventStreamReader
- type UnknownEventMessageError
Constants ¶
const ServiceAPIVersion = "2020-08-07"
const ServiceID = "Lex Runtime V2"
Variables ¶
This section is empty.
Functions ¶
func NewDefaultEndpointResolver ¶
func NewDefaultEndpointResolver() *internalendpoints.Resolver
NewDefaultEndpointResolver constructs a new service endpoint resolver
func WithAPIOptions ¶
func WithAPIOptions(optFns ...func(*middleware.Stack) error) func(*Options)
WithAPIOptions returns a functional option for setting the Client's APIOptions option.
func WithEndpointResolver ¶
func WithEndpointResolver(v EndpointResolver) func(*Options)
WithEndpointResolver returns a functional option for setting the Client's EndpointResolver option.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides the API client to make operations call for Amazon Lex Runtime V2.
func New ¶
New returns an initialized Client based on the functional options. Provide additional functional options to further configure the behavior of the client, such as changing the client's endpoint or adding custom middleware behavior.
func NewFromConfig ¶
NewFromConfig returns a new client from the provided config.
func (*Client) DeleteSession ¶
func (c *Client) DeleteSession(ctx context.Context, params *DeleteSessionInput, optFns ...func(*Options)) (*DeleteSessionOutput, error)
Removes session information for a specified bot, alias, and user ID. You can use this operation to restart a conversation with a bot. When you remove a session, the entire history of the session is removed so that you can start again. You don't need to delete a session. Sessions have a time limit and will expire. Set the session time limit when you create the bot. The default is 5 minutes, but you can specify anything between 1 minute and 24 hours. If you specify a bot or alias ID that doesn't exist, you receive a BadRequestException. If the locale doesn't exist in the bot, or if the locale hasn't been enables for the alias, you receive a BadRequestException.
func (*Client) GetSession ¶
func (c *Client) GetSession(ctx context.Context, params *GetSessionInput, optFns ...func(*Options)) (*GetSessionOutput, error)
Returns session information for a specified bot, alias, and user. For example, you can use this operation to retrieve session information for a user that has left a long-running session in use. If the bot, alias, or session identifier doesn't exist, Amazon Lex V2 returns a BadRequestException. If the locale doesn't exist or is not enabled for the alias, you receive a BadRequestException.
func (*Client) PutSession ¶
func (c *Client) PutSession(ctx context.Context, params *PutSessionInput, optFns ...func(*Options)) (*PutSessionOutput, error)
Creates a new session or modifies an existing session with an Amazon Lex V2 bot. Use this operation to enable your application to set the state of the bot.
func (*Client) RecognizeText ¶
func (c *Client) RecognizeText(ctx context.Context, params *RecognizeTextInput, optFns ...func(*Options)) (*RecognizeTextOutput, error)
Sends user input to Amazon Lex V2. Client applications use this API to send requests to Amazon Lex V2 at runtime. Amazon Lex V2 then interprets the user input using the machine learning model that it build for the bot. In response, Amazon Lex V2 returns the next message to convey to the user and an optional response card to display. If the optional post-fulfillment response is specified, the messages are returned as follows. For more information, see PostFulfillmentStatusSpecification (https://docs.aws.amazon.com/lexv2/latest/dg/API_PostFulfillmentStatusSpecification.html).
* Success message - Returned if the Lambda function completes successfully and the intent state is fulfilled or ready fulfillment if the message is present.
* Failed message - The failed message is returned if the Lambda function throws an exception or if the Lambda function returns a failed intent state without a message.
* Timeout message - If you don't configure a timeout message and a timeout, and the Lambda function doesn't return within 30 seconds, the timeout message is returned. If you configure a timeout, the timeout message is returned when the period times out.
For more information, see Completion message (https://docs.aws.amazon.com/lexv2/latest/dg/streaming-progress.html#progress-complete.html).
func (*Client) RecognizeUtterance ¶
func (c *Client) RecognizeUtterance(ctx context.Context, params *RecognizeUtteranceInput, optFns ...func(*Options)) (*RecognizeUtteranceOutput, error)
Sends user input to Amazon Lex V2. You can send text or speech. Clients use this API to send text and audio requests to Amazon Lex V2 at runtime. Amazon Lex V2 interprets the user input using the machine learning model built for the bot. The following request fields must be compressed with gzip and then base64 encoded before you send them to Amazon Lex V2.
* requestAttributes
* sessionState
The following response fields are compressed using gzip and then base64 encoded by Amazon Lex V2. Before you can use these fields, you must decode and decompress them.
* inputTranscript
* interpretations
* messages
* requestAttributes
* sessionState
The example contains a Java application that compresses and encodes a Java object to send to Amazon Lex V2, and a second that decodes and decompresses a response from Amazon Lex V2. If the optional post-fulfillment response is specified, the messages are returned as follows. For more information, see PostFulfillmentStatusSpecification (https://docs.aws.amazon.com/lexv2/latest/dg/API_PostFulfillmentStatusSpecification.html).
* Success message - Returned if the Lambda function completes successfully and the intent state is fulfilled or ready fulfillment if the message is present.
* Failed message - The failed message is returned if the Lambda function throws an exception or if the Lambda function returns a failed intent state without a message.
* Timeout message - If you don't configure a timeout message and a timeout, and the Lambda function doesn't return within 30 seconds, the timeout message is returned. If you configure a timeout, the timeout message is returned when the period times out.
For more information, see Completion message (https://docs.aws.amazon.com/lexv2/latest/dg/streaming-progress.html#progress-complete.html).
func (*Client) StartConversation ¶ added in v1.10.0
func (c *Client) StartConversation(ctx context.Context, params *StartConversationInput, optFns ...func(*Options)) (*StartConversationOutput, error)
Starts an HTTP/2 bidirectional event stream that enables you to send audio, text, or DTMF input in real time. After your application starts a conversation, users send input to Amazon Lex V2 as a stream of events. Amazon Lex V2 processes the incoming events and responds with streaming text or audio events. Audio input must be in the following format: audio/lpcm sample-rate=8000 sample-size-bits=16 channel-count=1; is-big-endian=false. If the optional post-fulfillment response is specified, the messages are returned as follows. For more information, see PostFulfillmentStatusSpecification (https://docs.aws.amazon.com/lexv2/latest/dg/API_PostFulfillmentStatusSpecification.html).
* Success message - Returned if the Lambda function completes successfully and the intent state is fulfilled or ready fulfillment if the message is present.
* Failed message - The failed message is returned if the Lambda function throws an exception or if the Lambda function returns a failed intent state without a message.
* Timeout message - If you don't configure a timeout message and a timeout, and the Lambda function doesn't return within 30 seconds, the timeout message is returned. If you configure a timeout, the timeout message is returned when the period times out.
For more information, see Completion message (https://docs.aws.amazon.com/lexv2/latest/dg/streaming-progress.html#progress-complete.html). If the optional update message is configured, it is played at the specified frequency while the Lambda function is running and the update message state is active. If the fulfillment update message is not active, the Lambda function runs with a 30 second timeout. For more information, see Update message (https://docs.aws.amazon.com/lexv2/latest/dg/streaming-progress.html#progress-update.html) The StartConversation operation is supported only in the following SDKs:
* AWS SDK for C++ (https://docs.aws.amazon.com/goto/SdkForCpp/runtime.lex.v2-2020-08-07/StartConversation)
* AWS SDK for Java V2 (https://docs.aws.amazon.com/goto/SdkForJavaV2/runtime.lex.v2-2020-08-07/StartConversation)
* AWS SDK for Ruby V3 (https://docs.aws.amazon.com/goto/SdkForRubyV3/runtime.lex.v2-2020-08-07/StartConversation)
type DeleteSessionInput ¶
type DeleteSessionInput struct { // The alias identifier in use for the bot that contains the session data. // // This member is required. BotAliasId *string // The identifier of the bot that contains the session data. // // This member is required. BotId *string // The locale where the session is in use. // // This member is required. LocaleId *string // The identifier of the session to delete. // // This member is required. SessionId *string // contains filtered or unexported fields }
type DeleteSessionOutput ¶
type DeleteSessionOutput struct { // The alias identifier in use for the bot that contained the session data. BotAliasId *string // The identifier of the bot that contained the session data. BotId *string // The locale where the session was used. LocaleId *string // The identifier of the deleted session. SessionId *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata // contains filtered or unexported fields }
type EndpointResolver ¶
type EndpointResolver interface {
ResolveEndpoint(region string, options EndpointResolverOptions) (aws.Endpoint, error)
}
EndpointResolver interface for resolving service endpoints.
func EndpointResolverFromURL ¶
func EndpointResolverFromURL(url string, optFns ...func(*aws.Endpoint)) EndpointResolver
EndpointResolverFromURL returns an EndpointResolver configured using the provided endpoint url. By default, the resolved endpoint resolver uses the client region as signing region, and the endpoint source is set to EndpointSourceCustom.You can provide functional options to configure endpoint values for the resolved endpoint.
type EndpointResolverFunc ¶
type EndpointResolverFunc func(region string, options EndpointResolverOptions) (aws.Endpoint, error)
EndpointResolverFunc is a helper utility that wraps a function so it satisfies the EndpointResolver interface. This is useful when you want to add additional endpoint resolving logic, or stub out specific endpoints with custom values.
func (EndpointResolverFunc) ResolveEndpoint ¶
func (fn EndpointResolverFunc) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error)
type EndpointResolverOptions ¶
type EndpointResolverOptions = internalendpoints.Options
EndpointResolverOptions is the service endpoint resolver options
type GetSessionInput ¶
type GetSessionInput struct { // The alias identifier in use for the bot that contains the session data. // // This member is required. BotAliasId *string // The identifier of the bot that contains the session data. // // This member is required. BotId *string // The locale where the session is in use. // // This member is required. LocaleId *string // The identifier of the session to return. // // This member is required. SessionId *string // contains filtered or unexported fields }
type GetSessionOutput ¶
type GetSessionOutput struct { // A list of intents that Amazon Lex V2 determined might satisfy the user's // utterance. Each interpretation includes the intent, a score that indicates how // confident Amazon Lex V2 is that the interpretation is the correct one, and an // optional sentiment response that indicates the sentiment expressed in the // utterance. Interpretations []types.Interpretation // A list of messages that were last sent to the user. The messages are ordered // based on the order that your returned the messages from your Lambda function or // the order that messages are defined in the bot. Messages []types.Message // The identifier of the returned session. SessionId *string // Represents the current state of the dialog between the user and the bot. You can // use this to determine the progress of the conversation and what the next action // might be. SessionState *types.SessionState // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata // contains filtered or unexported fields }
type HTTPSignerV4 ¶
type Options ¶
type Options struct { // Set of options to modify how an operation is invoked. These apply to all // operations invoked for this client. Use functional options on operation call to // modify this list for per operation behavior. APIOptions []func(*middleware.Stack) error // Configures the events that will be sent to the configured logger. ClientLogMode aws.ClientLogMode // The credentials object to use when signing requests. Credentials aws.CredentialsProvider // The configuration DefaultsMode that the SDK should use when constructing the // clients initial default settings. DefaultsMode aws.DefaultsMode // The endpoint options to be used when attempting to resolve an endpoint. EndpointOptions EndpointResolverOptions // The service endpoint resolver. EndpointResolver EndpointResolver // Signature Version 4 (SigV4) Signer HTTPSignerV4 HTTPSignerV4 // The logger writer interface to write logging messages to. Logger logging.Logger // The region to send requests to. (Required) Region string // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify // per operation call's retry max attempts. When creating a new API Clients this // member will only be used if the Retryer Options member is nil. This value will // be ignored if Retryer is not nil. If specified in an operation call's functional // options with a value that is different than the constructed client's Options, // the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int // RetryMode specifies the retry mode the API client will be created with, if // Retryer option is not also specified. When creating a new API Clients this // member will only be used if the Retryer Options member is nil. This value will // be ignored if Retryer is not nil. Currently does not support per operation call // overrides, may in the future. RetryMode aws.RetryMode // Retryer guides how HTTP requests should be retried in case of recoverable // failures. When nil the API client will use a default retryer. The kind of // default retry created by the API client can be changed with the RetryMode // option. Retryer aws.Retryer // The RuntimeEnvironment configuration, only populated if the DefaultsMode is set // to DefaultsModeAuto and is initialized using config.LoadDefaultConfig. You // should not populate this structure programmatically, or rely on the values here // within your applications. RuntimeEnvironment aws.RuntimeEnvironment // The HTTP client to invoke API calls with. Defaults to client's default HTTP // implementation if nil. HTTPClient HTTPClient // contains filtered or unexported fields }
type PutSessionInput ¶
type PutSessionInput struct { // The alias identifier of the bot that receives the session data. // // This member is required. BotAliasId *string // The identifier of the bot that receives the session data. // // This member is required. BotId *string // The locale where the session is in use. // // This member is required. LocaleId *string // The identifier of the session that receives the session data. // // This member is required. SessionId *string // Sets the state of the session with the user. You can use this to set the current // intent, attributes, context, and dialog action. Use the dialog action to // determine the next step that Amazon Lex V2 should use in the conversation with // the user. // // This member is required. SessionState *types.SessionState // A list of messages to send to the user. Messages are sent in the order that they // are defined in the list. Messages []types.Message // Request-specific information passed between Amazon Lex V2 and the client // application. The namespace x-amz-lex: is reserved for special attributes. Don't // create any request attributes with the prefix x-amz-lex:. RequestAttributes map[string]string // The message that Amazon Lex V2 returns in the response can be either text or // speech depending on the value of this parameter. // // * If the value is text/plain; // charset=utf-8, Amazon Lex V2 returns text in the response. ResponseContentType *string // contains filtered or unexported fields }
type PutSessionOutput ¶
type PutSessionOutput struct { // If the requested content type was audio, the audio version of the message to // convey to the user. AudioStream io.ReadCloser // The type of response. Same as the type specified in the responseContentType // field in the request. ContentType *string // A list of messages that were last sent to the user. The messages are ordered // based on how you return the messages from you Lambda function or the order that // the messages are defined in the bot. Messages *string // Request-specific information passed between the client application and Amazon // Lex V2. These are the same as the requestAttribute parameter in the call to the // PutSession operation. RequestAttributes *string // The identifier of the session that received the data. SessionId *string // Represents the current state of the dialog between the user and the bot. Use // this to determine the progress of the conversation and what the next action may // be. SessionState *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata // contains filtered or unexported fields }
type RecognizeTextInput ¶
type RecognizeTextInput struct { // The alias identifier in use for the bot that processes the request. // // This member is required. BotAliasId *string // The identifier of the bot that processes the request. // // This member is required. BotId *string // The locale where the session is in use. // // This member is required. LocaleId *string // The identifier of the user session that is having the conversation. // // This member is required. SessionId *string // The text that the user entered. Amazon Lex V2 interprets this text. // // This member is required. Text *string // Request-specific information passed between the client application and Amazon // Lex V2 The namespace x-amz-lex: is reserved for special attributes. Don't create // any request attributes with the prefix x-amz-lex:. RequestAttributes map[string]string // The current state of the dialog between the user and the bot. SessionState *types.SessionState // contains filtered or unexported fields }
type RecognizeTextOutput ¶
type RecognizeTextOutput struct { // A list of intents that Amazon Lex V2 determined might satisfy the user's // utterance. Each interpretation includes the intent, a score that indicates now // confident Amazon Lex V2 is that the interpretation is the correct one, and an // optional sentiment response that indicates the sentiment expressed in the // utterance. Interpretations []types.Interpretation // A list of messages last sent to the user. The messages are ordered based on the // order that you returned the messages from your Lambda function or the order that // the messages are defined in the bot. Messages []types.Message // The attributes sent in the request. RequestAttributes map[string]string // The identifier of the session in use. SessionId *string // Represents the current state of the dialog between the user and the bot. Use // this to determine the progress of the conversation and what the next action may // be. SessionState *types.SessionState // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata // contains filtered or unexported fields }
type RecognizeUtteranceInput ¶
type RecognizeUtteranceInput struct { // The alias identifier in use for the bot that should receive the request. // // This member is required. BotAliasId *string // The identifier of the bot that should receive the request. // // This member is required. BotId *string // The locale where the session is in use. // // This member is required. LocaleId *string // Indicates the format for audio input or that the content is text. The header // must start with one of the following prefixes: // // * PCM format, audio data must be // in little-endian byte order. // // * audio/l16; rate=16000; channels=1 // // * // audio/x-l16; sample-rate=16000; channel-count=1 // // * audio/lpcm; sample-rate=8000; // sample-size-bits=16; channel-count=1; is-big-endian=false // // * Opus format // // * // audio/x-cbr-opus-with-preamble;preamble-size=0;bit-rate=256000;frame-size-milliseconds=4 // // * // Text format // // * text/plain; charset=utf-8 // // This member is required. RequestContentType *string // The identifier of the session in use. // // This member is required. SessionId *string // User input in PCM or Opus audio format or text format as described in the // requestContentType parameter. InputStream io.Reader // Request-specific information passed between the client application and Amazon // Lex V2 The namespace x-amz-lex: is reserved for special attributes. Don't create // any request attributes for prefix x-amz-lex:. The requestAttributes field must // be compressed using gzip and then base64 encoded before sending to Amazon Lex // V2. RequestAttributes *string // The message that Amazon Lex V2 returns in the response can be either text or // speech based on the responseContentType value. // // * If the value is // text/plain;charset=utf-8, Amazon Lex V2 returns text in the response. // // * If the // value begins with audio/, Amazon Lex V2 returns speech in the response. Amazon // Lex V2 uses Amazon Polly to generate the speech using the configuration that you // specified in the requestContentType parameter. For example, if you specify // audio/mpeg as the value, Amazon Lex V2 returns speech in the MPEG format. // // * If // the value is audio/pcm, the speech returned is audio/pcm at 16 KHz in 16-bit, // little-endian format. // // * The following are the accepted values: // // * audio/mpeg // // * // audio/ogg // // * audio/pcm (16 KHz) // // * audio/* (defaults to mpeg) // // * text/plain; // charset=utf-8 ResponseContentType *string // Sets the state of the session with the user. You can use this to set the current // intent, attributes, context, and dialog action. Use the dialog action to // determine the next step that Amazon Lex V2 should use in the conversation with // the user. The sessionState field must be compressed using gzip and then base64 // encoded before sending to Amazon Lex V2. SessionState *string // contains filtered or unexported fields }
type RecognizeUtteranceOutput ¶
type RecognizeUtteranceOutput struct { // The prompt or statement to send to the user. This is based on the bot // configuration and context. For example, if Amazon Lex V2 did not understand the // user intent, it sends the clarificationPrompt configured for the bot. If the // intent requires confirmation before taking the fulfillment action, it sends the // confirmationPrompt. Another example: Suppose that the Lambda function // successfully fulfilled the intent, and sent a message to convey to the user. // Then Amazon Lex V2 sends that message in the response. AudioStream io.ReadCloser // Content type as specified in the responseContentType in the request. ContentType *string // Indicates whether the input mode to the operation was text or speech. InputMode *string // The text used to process the request. If the input was an audio stream, the // inputTranscript field contains the text extracted from the audio stream. This is // the text that is actually processed to recognize intents and slot values. You // can use this information to determine if Amazon Lex V2 is correctly processing // the audio that you send. The inputTranscript field is compressed with gzip and // then base64 encoded. Before you can use the contents of the field, you must // decode and decompress the contents. See the example for a simple function to // decode and decompress the contents. InputTranscript *string // A list of intents that Amazon Lex V2 determined might satisfy the user's // utterance. Each interpretation includes the intent, a score that indicates how // confident Amazon Lex V2 is that the interpretation is the correct one, and an // optional sentiment response that indicates the sentiment expressed in the // utterance. The interpretations field is compressed with gzip and then base64 // encoded. Before you can use the contents of the field, you must decode and // decompress the contents. See the example for a simple function to decode and // decompress the contents. Interpretations *string // A list of messages that were last sent to the user. The messages are ordered // based on the order that you returned the messages from your Lambda function or // the order that the messages are defined in the bot. The messages field is // compressed with gzip and then base64 encoded. Before you can use the contents of // the field, you must decode and decompress the contents. See the example for a // simple function to decode and decompress the contents. Messages *string // The attributes sent in the request. The requestAttributes field is compressed // with gzip and then base64 encoded. Before you can use the contents of the field, // you must decode and decompress the contents. RequestAttributes *string // The identifier of the session in use. SessionId *string // Represents the current state of the dialog between the user and the bot. Use // this to determine the progress of the conversation and what the next action // might be. The sessionState field is compressed with gzip and then base64 // encoded. Before you can use the contents of the field, you must decode and // decompress the contents. See the example for a simple function to decode and // decompress the contents. SessionState *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata // contains filtered or unexported fields }
type ResolveEndpoint ¶
type ResolveEndpoint struct { Resolver EndpointResolver Options EndpointResolverOptions }
func (*ResolveEndpoint) HandleSerialize ¶
func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, )
func (*ResolveEndpoint) ID ¶
func (*ResolveEndpoint) ID() string
type StartConversationEventStream ¶ added in v1.10.0
type StartConversationEventStream struct { // StartConversationRequestEventStreamWriter is the EventStream writer for the // StartConversationRequestEventStream events. This value is automatically set by // the SDK when the API call is made Use this member when unit testing your code // with the SDK to mock out the EventStream Writer. // // Must not be nil. Writer StartConversationRequestEventStreamWriter // StartConversationResponseEventStreamReader is the EventStream reader for the // StartConversationResponseEventStream events. This value is automatically set by // the SDK when the API call is made Use this member when unit testing your code // with the SDK to mock out the EventStream Reader. // // Must not be nil. Reader StartConversationResponseEventStreamReader // contains filtered or unexported fields }
StartConversationEventStream provides the event stream handling for the StartConversation operation.
For testing and mocking the event stream this type should be initialized via the NewStartConversationEventStream constructor function. Using the functional options to pass in nested mock behavior.
func NewStartConversationEventStream ¶ added in v1.10.0
func NewStartConversationEventStream(optFns ...func(*StartConversationEventStream)) *StartConversationEventStream
NewStartConversationEventStream initializes an StartConversationEventStream. This function should only be used for testing and mocking the StartConversationEventStream stream within your application.
The Writer member must be set before writing events to the stream.
The Reader member must be set before reading events from the stream.
func (*StartConversationEventStream) Close ¶ added in v1.10.0
func (es *StartConversationEventStream) Close() error
Close closes the stream. This will also cause the stream to be closed. Close must be called when done using the stream API. Not calling Close may result in resource leaks.
Will close the underlying EventStream writer and reader, and no more events can be sent or received.
func (*StartConversationEventStream) Err ¶ added in v1.10.0
func (es *StartConversationEventStream) Err() error
Err returns any error that occurred while reading or writing EventStream Events from the service API's response. Returns nil if there were no errors.
func (*StartConversationEventStream) Events ¶ added in v1.10.0
func (es *StartConversationEventStream) Events() <-chan types.StartConversationResponseEventStream
Events returns a channel to read events from.
func (*StartConversationEventStream) Send ¶ added in v1.10.0
func (es *StartConversationEventStream) Send(ctx context.Context, event types.StartConversationRequestEventStream) error
Send writes the event to the stream blocking until the event is written. Returns an error if the event was not written.
type StartConversationInput ¶ added in v1.10.0
type StartConversationInput struct { // The alias identifier in use for the bot that processes the request. // // This member is required. BotAliasId *string // The identifier of the bot to process the request. // // This member is required. BotId *string // The locale where the session is in use. // // This member is required. LocaleId *string // The identifier of the user session that is having the conversation. // // This member is required. SessionId *string // The conversation type that you are using the Amazon Lex V2. If the conversation // mode is AUDIO you can send both audio and DTMF information. If the mode is TEXT // you can only send text. ConversationMode types.ConversationMode // contains filtered or unexported fields }
type StartConversationOutput ¶ added in v1.10.0
type StartConversationOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata // contains filtered or unexported fields }
func (*StartConversationOutput) GetStream ¶ added in v1.10.0
func (o *StartConversationOutput) GetStream() *StartConversationEventStream
GetStream returns the type to interact with the event stream.
type StartConversationRequestEventStreamWriter ¶ added in v1.10.0
type StartConversationRequestEventStreamWriter interface { Send(context.Context, types.StartConversationRequestEventStream) error Close() error Err() error }
StartConversationRequestEventStreamWriter provides the interface for writing events to a stream.
The writer's Close method must allow multiple concurrent calls.
type StartConversationResponseEventStreamReader ¶ added in v1.10.0
type StartConversationResponseEventStreamReader interface { Events() <-chan types.StartConversationResponseEventStream Close() error Err() error }
StartConversationResponseEventStreamReader provides the interface for reading events from a stream.
The writer's Close method must allow multiple concurrent calls.
type UnknownEventMessageError ¶ added in v1.10.0
type UnknownEventMessageError struct { Type string Message *eventstream.Message }
UnknownEventMessageError provides an error when a message is received from the stream, but the reader is unable to determine what kind of message it is.
func (*UnknownEventMessageError) Error ¶ added in v1.10.0
func (e *UnknownEventMessageError) Error() string
Error retruns the error message string.