lexruntimev2

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2021 License: Apache-2.0 Imports: 26 Imported by: 6

Documentation

Overview

Package lexruntimev2 provides the API client, operations, and parameter types for Amazon Lex Runtime V2.

Index

Constants

View Source
const ServiceAPIVersion = "2020-08-07"
View Source
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

func New(options Options, optFns ...func(*Options)) *Client

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

func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client

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 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 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. Client applications use this API to send requests to Amazon Lex at runtime. Amazon Lex then interprets the user input using the machine learning model that it build for the bot. In response, Amazon Lex returns the next message to convey to the user and an optional response card to display.

func (*Client) RecognizeUtterance

func (c *Client) RecognizeUtterance(ctx context.Context, params *RecognizeUtteranceInput, optFns ...func(*Options)) (*RecognizeUtteranceOutput, error)

Sends user input to Amazon Lex. You can send text or speech. Clients use this API to send text and audio requests to Amazon Lex at runtime. Amazon Lex interprets the user input using the machine learning model built for the bot.

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
}

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
}

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
}

type GetSessionOutput

type GetSessionOutput struct {

	// A list of intents that Amazon Lex determined might satisfy the user's utterance.
	// Each interpretation includes the intent, a score that indicates how confident
	// Amazon Lex 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
}

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

type HTTPSignerV4

type HTTPSignerV4 interface {
	SignHTTP(ctx context.Context, credentials aws.Credentials, r *http.Request, payloadHash string, service string, region string, signingTime time.Time, optFns ...func(*v4.SignerOptions)) error
}

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 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

	// Retryer guides how HTTP requests should be retried in case of recoverable
	// failures. When nil the API client will use a default retryer.
	Retryer aws.Retryer

	// The HTTP client to invoke API calls with. Defaults to client's default HTTP
	// implementation if nil.
	HTTPClient HTTPClient
}

func (Options) Copy

func (o Options) Copy() Options

Copy creates a clone where the APIOptions list is deep copied.

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 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 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 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 returns text in the response.
	ResponseContentType *string
}

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. 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
}

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 interprets this text.
	//
	// This member is required.
	Text *string

	// Request-specific information passed between the client application and Amazon
	// Lex 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
}

type RecognizeTextOutput

type RecognizeTextOutput struct {

	// A list of intents that Amazon Lex determined might satisfy the user's utterance.
	// Each interpretation includes the intent, a score that indicates now confident
	// Amazon Lex 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
}

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 The namespace x-amz-lex: is reserved for special attributes. Don't create
	// any request attributes for prefix x-amz-lex:.
	RequestAttributes *string

	// The message that Amazon Lex 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 returns text in the response.
	//
	// * If the
	// value begins with audio/, Amazon Lex returns speech in the response. Amazon Lex
	// 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 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 should use in the conversation with the
	// user.
	SessionState *string
}

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 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 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 is correctly processing the
	// audio that you send.
	InputTranscript *string

	// A list of intents that Amazon Lex determined might satisfy the user's utterance.
	// Each interpretation includes the intent, a score that indicates how confident
	// Amazon Lex is that the interpretation is the correct one, and an optional
	// sentiment response that indicates the sentiment expressed in the utterance.
	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.
	Messages *string

	// The attributes sent in the request.
	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.
	SessionState *string

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata
}

type ResolveEndpoint

type ResolveEndpoint struct {
	Resolver EndpointResolver
	Options  EndpointResolverOptions
}

func (*ResolveEndpoint) HandleSerialize

func (*ResolveEndpoint) ID

func (*ResolveEndpoint) ID() string

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL