1// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 3package lexruntimeservice 4 5import ( 6 "io" 7 8 "github.com/aws/aws-sdk-go/aws" 9 "github.com/aws/aws-sdk-go/aws/awsutil" 10 "github.com/aws/aws-sdk-go/aws/request" 11 "github.com/aws/aws-sdk-go/aws/signer/v4" 12) 13 14const opPostContent = "PostContent" 15 16// PostContentRequest generates a "aws/request.Request" representing the 17// client's request for the PostContent operation. The "output" return 18// value will be populated with the request's response once the request completes 19// successfuly. 20// 21// Use "Send" method on the returned Request to send the API call to the service. 22// the "output" return value is not valid until after Send returns without error. 23// 24// See PostContent for more information on using the PostContent 25// API call, and error handling. 26// 27// This method is useful when you want to inject custom logic or configuration 28// into the SDK's request lifecycle. Such as custom headers, or retry logic. 29// 30// 31// // Example sending a request using the PostContentRequest method. 32// req, resp := client.PostContentRequest(params) 33// 34// err := req.Send() 35// if err == nil { // resp is now filled 36// fmt.Println(resp) 37// } 38// 39// See also, https://docs.aws.amazon.com/goto/WebAPI/runtime.lex-2016-11-28/PostContent 40func (c *LexRuntimeService) PostContentRequest(input *PostContentInput) (req *request.Request, output *PostContentOutput) { 41 op := &request.Operation{ 42 Name: opPostContent, 43 HTTPMethod: "POST", 44 HTTPPath: "/bot/{botName}/alias/{botAlias}/user/{userId}/content", 45 } 46 47 if input == nil { 48 input = &PostContentInput{} 49 } 50 51 output = &PostContentOutput{} 52 req = c.newRequest(op, input, output) 53 req.Handlers.Sign.Remove(v4.SignRequestHandler) 54 handler := v4.BuildNamedHandler("v4.CustomSignerHandler", v4.WithUnsignedPayload) 55 req.Handlers.Sign.PushFrontNamed(handler) 56 return 57} 58 59// PostContent API operation for Amazon Lex Runtime Service. 60// 61// Sends user input (text or speech) to Amazon Lex. Clients use this API to 62// send text and audio requests to Amazon Lex at runtime. Amazon Lex interprets 63// the user input using the machine learning model that it built for the bot. 64// 65// The PostContent operation supports audio input at 8kHz and 16kHz. You can 66// use 8kHz audio to achieve higher speech recognition accuracy in telephone 67// audio applications. 68// 69// In response, Amazon Lex returns the next message to convey to the user. Consider 70// the following example messages: 71// 72// * For a user input "I would like a pizza," Amazon Lex might return a 73// response with a message eliciting slot data (for example, PizzaSize): 74// "What size pizza would you like?". 75// 76// * After the user provides all of the pizza order information, Amazon 77// Lex might return a response with a message to get user confirmation: "Order 78// the pizza?". 79// 80// * After the user replies "Yes" to the confirmation prompt, Amazon Lex 81// might return a conclusion statement: "Thank you, your cheese pizza has 82// been ordered.". 83// 84// Not all Amazon Lex messages require a response from the user. For example, 85// conclusion statements do not require a response. Some messages require only 86// a yes or no response. In addition to the message, Amazon Lex provides additional 87// context about the message in the response that you can use to enhance client 88// behavior, such as displaying the appropriate client user interface. Consider 89// the following examples: 90// 91// * If the message is to elicit slot data, Amazon Lex returns the following 92// context information: 93// 94// x-amz-lex-dialog-state header set to ElicitSlot 95// 96// x-amz-lex-intent-name header set to the intent name in the current context 97// 98// 99// x-amz-lex-slot-to-elicit header set to the slot name for which the message 100// is eliciting information 101// 102// x-amz-lex-slots header set to a map of slots configured for the intent with 103// their current values 104// 105// * If the message is a confirmation prompt, the x-amz-lex-dialog-state 106// header is set to Confirmation and the x-amz-lex-slot-to-elicit header 107// is omitted. 108// 109// * If the message is a clarification prompt configured for the intent, 110// indicating that the user intent is not understood, the x-amz-dialog-state 111// header is set to ElicitIntent and the x-amz-slot-to-elicit header is omitted. 112// 113// 114// In addition, Amazon Lex also returns your application-specific sessionAttributes. 115// For more information, see Managing Conversation Context (http://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html). 116// 117// Returns awserr.Error for service API and SDK errors. Use runtime type assertions 118// with awserr.Error's Code and Message methods to get detailed information about 119// the error. 120// 121// See the AWS API reference guide for Amazon Lex Runtime Service's 122// API operation PostContent for usage and error information. 123// 124// Returned Error Codes: 125// * ErrCodeNotFoundException "NotFoundException" 126// The resource (such as the Amazon Lex bot or an alias) that is referred to 127// is not found. 128// 129// * ErrCodeBadRequestException "BadRequestException" 130// Request validation failed, there is no usable message in the context, or 131// the bot build failed, is still in progress, or contains unbuilt changes. 132// 133// * ErrCodeLimitExceededException "LimitExceededException" 134// Exceeded a limit. 135// 136// * ErrCodeInternalFailureException "InternalFailureException" 137// Internal service error. Retry the call. 138// 139// * ErrCodeConflictException "ConflictException" 140// Two clients are using the same AWS account, Amazon Lex bot, and user ID. 141// 142// * ErrCodeUnsupportedMediaTypeException "UnsupportedMediaTypeException" 143// The Content-Type header (PostContent API) has an invalid value. 144// 145// * ErrCodeNotAcceptableException "NotAcceptableException" 146// The accept header in the request does not have a valid value. 147// 148// * ErrCodeRequestTimeoutException "RequestTimeoutException" 149// The input speech is too long. 150// 151// * ErrCodeDependencyFailedException "DependencyFailedException" 152// One of the dependencies, such as AWS Lambda or Amazon Polly, threw an exception. 153// For example, 154// 155// * If Amazon Lex does not have sufficient permissions to call a Lambda 156// function. 157// 158// * If a Lambda function takes longer than 30 seconds to execute. 159// 160// * If a fulfillment Lambda function returns a Delegate dialog action without 161// removing any slot values. 162// 163// * ErrCodeBadGatewayException "BadGatewayException" 164// Either the Amazon Lex bot is still building, or one of the dependent services 165// (Amazon Polly, AWS Lambda) failed with an internal service error. 166// 167// * ErrCodeLoopDetectedException "LoopDetectedException" 168// This exception is not used. 169// 170// See also, https://docs.aws.amazon.com/goto/WebAPI/runtime.lex-2016-11-28/PostContent 171func (c *LexRuntimeService) PostContent(input *PostContentInput) (*PostContentOutput, error) { 172 req, out := c.PostContentRequest(input) 173 return out, req.Send() 174} 175 176// PostContentWithContext is the same as PostContent with the addition of 177// the ability to pass a context and additional request options. 178// 179// See PostContent for details on how to use this API operation. 180// 181// The context must be non-nil and will be used for request cancellation. If 182// the context is nil a panic will occur. In the future the SDK may create 183// sub-contexts for http.Requests. See https://golang.org/pkg/context/ 184// for more information on using Contexts. 185func (c *LexRuntimeService) PostContentWithContext(ctx aws.Context, input *PostContentInput, opts ...request.Option) (*PostContentOutput, error) { 186 req, out := c.PostContentRequest(input) 187 req.SetContext(ctx) 188 req.ApplyOptions(opts...) 189 return out, req.Send() 190} 191 192const opPostText = "PostText" 193 194// PostTextRequest generates a "aws/request.Request" representing the 195// client's request for the PostText operation. The "output" return 196// value will be populated with the request's response once the request completes 197// successfuly. 198// 199// Use "Send" method on the returned Request to send the API call to the service. 200// the "output" return value is not valid until after Send returns without error. 201// 202// See PostText for more information on using the PostText 203// API call, and error handling. 204// 205// This method is useful when you want to inject custom logic or configuration 206// into the SDK's request lifecycle. Such as custom headers, or retry logic. 207// 208// 209// // Example sending a request using the PostTextRequest method. 210// req, resp := client.PostTextRequest(params) 211// 212// err := req.Send() 213// if err == nil { // resp is now filled 214// fmt.Println(resp) 215// } 216// 217// See also, https://docs.aws.amazon.com/goto/WebAPI/runtime.lex-2016-11-28/PostText 218func (c *LexRuntimeService) PostTextRequest(input *PostTextInput) (req *request.Request, output *PostTextOutput) { 219 op := &request.Operation{ 220 Name: opPostText, 221 HTTPMethod: "POST", 222 HTTPPath: "/bot/{botName}/alias/{botAlias}/user/{userId}/text", 223 } 224 225 if input == nil { 226 input = &PostTextInput{} 227 } 228 229 output = &PostTextOutput{} 230 req = c.newRequest(op, input, output) 231 return 232} 233 234// PostText API operation for Amazon Lex Runtime Service. 235// 236// Sends user input (text-only) to Amazon Lex. Client applications can use this 237// API to send requests to Amazon Lex at runtime. Amazon Lex then interprets 238// the user input using the machine learning model it built for the bot. 239// 240// In response, Amazon Lex returns the next message to convey to the user an 241// optional responseCard to display. Consider the following example messages: 242// 243// * For a user input "I would like a pizza", Amazon Lex might return a 244// response with a message eliciting slot data (for example, PizzaSize): 245// "What size pizza would you like?" 246// 247// * After the user provides all of the pizza order information, Amazon 248// Lex might return a response with a message to obtain user confirmation 249// "Proceed with the pizza order?". 250// 251// * After the user replies to a confirmation prompt with a "yes", Amazon 252// Lex might return a conclusion statement: "Thank you, your cheese pizza 253// has been ordered.". 254// 255// Not all Amazon Lex messages require a user response. For example, a conclusion 256// statement does not require a response. Some messages require only a "yes" 257// or "no" user response. In addition to the message, Amazon Lex provides additional 258// context about the message in the response that you might use to enhance client 259// behavior, for example, to display the appropriate client user interface. 260// These are the slotToElicit, dialogState, intentName, and slots fields in 261// the response. Consider the following examples: 262// 263// * If the message is to elicit slot data, Amazon Lex returns the following 264// context information: 265// 266// dialogState set to ElicitSlot 267// 268// intentName set to the intent name in the current context 269// 270// slotToElicit set to the slot name for which the message is eliciting information 271// 272// 273// slots set to a map of slots, configured for the intent, with currently known 274// values 275// 276// * If the message is a confirmation prompt, the dialogState is set to 277// ConfirmIntent and SlotToElicit is set to null. 278// 279// * If the message is a clarification prompt (configured for the intent) 280// that indicates that user intent is not understood, the dialogState is 281// set to ElicitIntent and slotToElicit is set to null. 282// 283// In addition, Amazon Lex also returns your application-specific sessionAttributes. 284// For more information, see Managing Conversation Context (http://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html). 285// 286// Returns awserr.Error for service API and SDK errors. Use runtime type assertions 287// with awserr.Error's Code and Message methods to get detailed information about 288// the error. 289// 290// See the AWS API reference guide for Amazon Lex Runtime Service's 291// API operation PostText for usage and error information. 292// 293// Returned Error Codes: 294// * ErrCodeNotFoundException "NotFoundException" 295// The resource (such as the Amazon Lex bot or an alias) that is referred to 296// is not found. 297// 298// * ErrCodeBadRequestException "BadRequestException" 299// Request validation failed, there is no usable message in the context, or 300// the bot build failed, is still in progress, or contains unbuilt changes. 301// 302// * ErrCodeLimitExceededException "LimitExceededException" 303// Exceeded a limit. 304// 305// * ErrCodeInternalFailureException "InternalFailureException" 306// Internal service error. Retry the call. 307// 308// * ErrCodeConflictException "ConflictException" 309// Two clients are using the same AWS account, Amazon Lex bot, and user ID. 310// 311// * ErrCodeDependencyFailedException "DependencyFailedException" 312// One of the dependencies, such as AWS Lambda or Amazon Polly, threw an exception. 313// For example, 314// 315// * If Amazon Lex does not have sufficient permissions to call a Lambda 316// function. 317// 318// * If a Lambda function takes longer than 30 seconds to execute. 319// 320// * If a fulfillment Lambda function returns a Delegate dialog action without 321// removing any slot values. 322// 323// * ErrCodeBadGatewayException "BadGatewayException" 324// Either the Amazon Lex bot is still building, or one of the dependent services 325// (Amazon Polly, AWS Lambda) failed with an internal service error. 326// 327// * ErrCodeLoopDetectedException "LoopDetectedException" 328// This exception is not used. 329// 330// See also, https://docs.aws.amazon.com/goto/WebAPI/runtime.lex-2016-11-28/PostText 331func (c *LexRuntimeService) PostText(input *PostTextInput) (*PostTextOutput, error) { 332 req, out := c.PostTextRequest(input) 333 return out, req.Send() 334} 335 336// PostTextWithContext is the same as PostText with the addition of 337// the ability to pass a context and additional request options. 338// 339// See PostText for details on how to use this API operation. 340// 341// The context must be non-nil and will be used for request cancellation. If 342// the context is nil a panic will occur. In the future the SDK may create 343// sub-contexts for http.Requests. See https://golang.org/pkg/context/ 344// for more information on using Contexts. 345func (c *LexRuntimeService) PostTextWithContext(ctx aws.Context, input *PostTextInput, opts ...request.Option) (*PostTextOutput, error) { 346 req, out := c.PostTextRequest(input) 347 req.SetContext(ctx) 348 req.ApplyOptions(opts...) 349 return out, req.Send() 350} 351 352// Represents an option to be shown on the client platform (Facebook, Slack, 353// etc.) 354type Button struct { 355 _ struct{} `type:"structure"` 356 357 // Text that is visible to the user on the button. 358 // 359 // Text is a required field 360 Text *string `locationName:"text" min:"1" type:"string" required:"true"` 361 362 // The value sent to Amazon Lex when a user chooses the button. For example, 363 // consider button text "NYC." When the user chooses the button, the value sent 364 // can be "New York City." 365 // 366 // Value is a required field 367 Value *string `locationName:"value" min:"1" type:"string" required:"true"` 368} 369 370// String returns the string representation 371func (s Button) String() string { 372 return awsutil.Prettify(s) 373} 374 375// GoString returns the string representation 376func (s Button) GoString() string { 377 return s.String() 378} 379 380// SetText sets the Text field's value. 381func (s *Button) SetText(v string) *Button { 382 s.Text = &v 383 return s 384} 385 386// SetValue sets the Value field's value. 387func (s *Button) SetValue(v string) *Button { 388 s.Value = &v 389 return s 390} 391 392// Represents an option rendered to the user when a prompt is shown. It could 393// be an image, a button, a link, or text. 394type GenericAttachment struct { 395 _ struct{} `type:"structure"` 396 397 // The URL of an attachment to the response card. 398 AttachmentLinkUrl *string `locationName:"attachmentLinkUrl" min:"1" type:"string"` 399 400 // The list of options to show to the user. 401 Buttons []*Button `locationName:"buttons" type:"list"` 402 403 // The URL of an image that is displayed to the user. 404 ImageUrl *string `locationName:"imageUrl" min:"1" type:"string"` 405 406 // The subtitle shown below the title. 407 SubTitle *string `locationName:"subTitle" min:"1" type:"string"` 408 409 // The title of the option. 410 Title *string `locationName:"title" min:"1" type:"string"` 411} 412 413// String returns the string representation 414func (s GenericAttachment) String() string { 415 return awsutil.Prettify(s) 416} 417 418// GoString returns the string representation 419func (s GenericAttachment) GoString() string { 420 return s.String() 421} 422 423// SetAttachmentLinkUrl sets the AttachmentLinkUrl field's value. 424func (s *GenericAttachment) SetAttachmentLinkUrl(v string) *GenericAttachment { 425 s.AttachmentLinkUrl = &v 426 return s 427} 428 429// SetButtons sets the Buttons field's value. 430func (s *GenericAttachment) SetButtons(v []*Button) *GenericAttachment { 431 s.Buttons = v 432 return s 433} 434 435// SetImageUrl sets the ImageUrl field's value. 436func (s *GenericAttachment) SetImageUrl(v string) *GenericAttachment { 437 s.ImageUrl = &v 438 return s 439} 440 441// SetSubTitle sets the SubTitle field's value. 442func (s *GenericAttachment) SetSubTitle(v string) *GenericAttachment { 443 s.SubTitle = &v 444 return s 445} 446 447// SetTitle sets the Title field's value. 448func (s *GenericAttachment) SetTitle(v string) *GenericAttachment { 449 s.Title = &v 450 return s 451} 452 453type PostContentInput struct { 454 _ struct{} `type:"structure" payload:"InputStream"` 455 456 // You pass this value as the Accept HTTP header. 457 // 458 // The message Amazon Lex returns in the response can be either text or speech 459 // based on the Accept HTTP header value in the request. 460 // 461 // * If the value is text/plain; charset=utf-8, Amazon Lex returns text 462 // in the response. 463 // 464 // * If the value begins with audio/, Amazon Lex returns speech in the response. 465 // Amazon Lex uses Amazon Polly to generate the speech (using the configuration 466 // you specified in the Accept header). For example, if you specify audio/mpeg 467 // as the value, Amazon Lex returns speech in the MPEG format. 468 // 469 // The following are the accepted values: 470 // 471 // audio/mpeg 472 // 473 // audio/ogg 474 // 475 // audio/pcm 476 // 477 // text/plain; charset=utf-8 478 // 479 // audio/* (defaults to mpeg) 480 Accept *string `location:"header" locationName:"Accept" type:"string"` 481 482 // Alias of the Amazon Lex bot. 483 // 484 // BotAlias is a required field 485 BotAlias *string `location:"uri" locationName:"botAlias" type:"string" required:"true"` 486 487 // Name of the Amazon Lex bot. 488 // 489 // BotName is a required field 490 BotName *string `location:"uri" locationName:"botName" type:"string" required:"true"` 491 492 // You pass this value as the Content-Type HTTP header. 493 // 494 // Indicates the audio format or text. The header value must start with one 495 // of the following prefixes: 496 // 497 // * PCM format, audio data must be in little-endian byte order. 498 // 499 // audio/l16; rate=16000; channels=1 500 // 501 // audio/x-l16; sample-rate=16000; channel-count=1 502 // 503 // audio/lpcm; sample-rate=8000; sample-size-bits=16; channel-count=1; is-big-endian=false 504 // 505 // 506 // * Opus format 507 // 508 // audio/x-cbr-opus-with-preamble; preamble-size=0; bit-rate=256000; frame-size-milliseconds=4 509 // 510 // * Text format 511 // 512 // text/plain; charset=utf-8 513 // 514 // ContentType is a required field 515 ContentType *string `location:"header" locationName:"Content-Type" type:"string" required:"true"` 516 517 // User input in PCM or Opus audio format or text format as described in the 518 // Content-Type HTTP header. 519 // 520 // You can stream audio data to Amazon Lex or you can create a local buffer 521 // that captures all of the audio data before sending. In general, you get better 522 // performance if you stream audio data rather than buffering the data locally. 523 // 524 // InputStream is a required field 525 InputStream io.ReadSeeker `locationName:"inputStream" type:"blob" required:"true"` 526 527 // You pass this value as the x-amz-lex-request-attributes HTTP header. 528 // 529 // Request-specific information passed between Amazon Lex and a client application. 530 // The value must be a JSON serialized and base64 encoded map with string keys 531 // and values. The total size of the requestAttributes and sessionAttributes 532 // headers is limited to 12 KB. 533 // 534 // The namespace x-amz-lex: is reserved for special attributes. Don't create 535 // any request attributes with the prefix x-amz-lex:. 536 // 537 // For more information, see Setting Request Attributes (http://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html#context-mgmt-request-attribs). 538 RequestAttributes aws.JSONValue `location:"header" locationName:"x-amz-lex-request-attributes" type:"jsonvalue"` 539 540 // You pass this value as the x-amz-lex-session-attributes HTTP header. 541 // 542 // Application-specific information passed between Amazon Lex and a client application. 543 // The value must be a JSON serialized and base64 encoded map with string keys 544 // and values. The total size of the sessionAttributes and requestAttributes 545 // headers is limited to 12 KB. 546 // 547 // For more information, see Setting Session Attributes (http://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html#context-mgmt-session-attribs). 548 SessionAttributes aws.JSONValue `location:"header" locationName:"x-amz-lex-session-attributes" type:"jsonvalue"` 549 550 // The ID of the client application user. Amazon Lex uses this to identify a 551 // user's conversation with your bot. At runtime, each request must contain 552 // the userID field. 553 // 554 // To decide the user ID to use for your application, consider the following 555 // factors. 556 // 557 // * The userID field must not contain any personally identifiable information 558 // of the user, for example, name, personal identification numbers, or other 559 // end user personal information. 560 // 561 // * If you want a user to start a conversation on one device and continue 562 // on another device, use a user-specific identifier. 563 // 564 // * If you want the same user to be able to have two independent conversations 565 // on two different devices, choose a device-specific identifier. 566 // 567 // * A user can't have two independent conversations with two different versions 568 // of the same bot. For example, a user can't have a conversation with the 569 // PROD and BETA versions of the same bot. If you anticipate that a user 570 // will need to have conversation with two different versions, for example, 571 // while testing, include the bot alias in the user ID to separate the two 572 // conversations. 573 // 574 // UserId is a required field 575 UserId *string `location:"uri" locationName:"userId" min:"2" type:"string" required:"true"` 576} 577 578// String returns the string representation 579func (s PostContentInput) String() string { 580 return awsutil.Prettify(s) 581} 582 583// GoString returns the string representation 584func (s PostContentInput) GoString() string { 585 return s.String() 586} 587 588// Validate inspects the fields of the type to determine if they are valid. 589func (s *PostContentInput) Validate() error { 590 invalidParams := request.ErrInvalidParams{Context: "PostContentInput"} 591 if s.BotAlias == nil { 592 invalidParams.Add(request.NewErrParamRequired("BotAlias")) 593 } 594 if s.BotName == nil { 595 invalidParams.Add(request.NewErrParamRequired("BotName")) 596 } 597 if s.ContentType == nil { 598 invalidParams.Add(request.NewErrParamRequired("ContentType")) 599 } 600 if s.InputStream == nil { 601 invalidParams.Add(request.NewErrParamRequired("InputStream")) 602 } 603 if s.UserId == nil { 604 invalidParams.Add(request.NewErrParamRequired("UserId")) 605 } 606 if s.UserId != nil && len(*s.UserId) < 2 { 607 invalidParams.Add(request.NewErrParamMinLen("UserId", 2)) 608 } 609 610 if invalidParams.Len() > 0 { 611 return invalidParams 612 } 613 return nil 614} 615 616// SetAccept sets the Accept field's value. 617func (s *PostContentInput) SetAccept(v string) *PostContentInput { 618 s.Accept = &v 619 return s 620} 621 622// SetBotAlias sets the BotAlias field's value. 623func (s *PostContentInput) SetBotAlias(v string) *PostContentInput { 624 s.BotAlias = &v 625 return s 626} 627 628// SetBotName sets the BotName field's value. 629func (s *PostContentInput) SetBotName(v string) *PostContentInput { 630 s.BotName = &v 631 return s 632} 633 634// SetContentType sets the ContentType field's value. 635func (s *PostContentInput) SetContentType(v string) *PostContentInput { 636 s.ContentType = &v 637 return s 638} 639 640// SetInputStream sets the InputStream field's value. 641func (s *PostContentInput) SetInputStream(v io.ReadSeeker) *PostContentInput { 642 s.InputStream = v 643 return s 644} 645 646// SetRequestAttributes sets the RequestAttributes field's value. 647func (s *PostContentInput) SetRequestAttributes(v aws.JSONValue) *PostContentInput { 648 s.RequestAttributes = v 649 return s 650} 651 652// SetSessionAttributes sets the SessionAttributes field's value. 653func (s *PostContentInput) SetSessionAttributes(v aws.JSONValue) *PostContentInput { 654 s.SessionAttributes = v 655 return s 656} 657 658// SetUserId sets the UserId field's value. 659func (s *PostContentInput) SetUserId(v string) *PostContentInput { 660 s.UserId = &v 661 return s 662} 663 664type PostContentOutput struct { 665 _ struct{} `type:"structure" payload:"AudioStream"` 666 667 // The prompt (or statement) to convey to the user. This is based on the bot 668 // configuration and context. For example, if Amazon Lex did not understand 669 // the user intent, it sends the clarificationPrompt configured for the bot. 670 // If the intent requires confirmation before taking the fulfillment action, 671 // it sends the confirmationPrompt. Another example: Suppose that the Lambda 672 // function successfully fulfilled the intent, and sent a message to convey 673 // to the user. Then Amazon Lex sends that message in the response. 674 AudioStream io.ReadCloser `locationName:"audioStream" type:"blob"` 675 676 // Content type as specified in the Accept HTTP header in the request. 677 ContentType *string `location:"header" locationName:"Content-Type" type:"string"` 678 679 // Identifies the current state of the user interaction. Amazon Lex returns 680 // one of the following values as dialogState. The client can optionally use 681 // this information to customize the user interface. 682 // 683 // * ElicitIntent - Amazon Lex wants to elicit the user's intent. Consider 684 // the following examples: 685 // 686 // For example, a user might utter an intent ("I want to order a pizza"). If 687 // Amazon Lex cannot infer the user intent from this utterance, it will return 688 // this dialog state. 689 // 690 // * ConfirmIntent - Amazon Lex is expecting a "yes" or "no" response. 691 // 692 // For example, Amazon Lex wants user confirmation before fulfilling an intent. 693 // Instead of a simple "yes" or "no" response, a user might respond with 694 // additional information. For example, "yes, but make it a thick crust pizza" 695 // or "no, I want to order a drink." Amazon Lex can process such additional 696 // information (in these examples, update the crust type slot or change the 697 // intent from OrderPizza to OrderDrink). 698 // 699 // * ElicitSlot - Amazon Lex is expecting the value of a slot for the current 700 // intent. 701 // 702 // For example, suppose that in the response Amazon Lex sends this message: 703 // "What size pizza would you like?". A user might reply with the slot value 704 // (e.g., "medium"). The user might also provide additional information in 705 // the response (e.g., "medium thick crust pizza"). Amazon Lex can process 706 // such additional information appropriately. 707 // 708 // * Fulfilled - Conveys that the Lambda function has successfully fulfilled 709 // the intent. 710 // 711 // * ReadyForFulfillment - Conveys that the client has to fulfill the request. 712 // 713 // 714 // * Failed - Conveys that the conversation with the user failed. 715 // 716 // This can happen for various reasons, including that the user does not provide 717 // an appropriate response to prompts from the service (you can configure 718 // how many times Amazon Lex can prompt a user for specific information), 719 // or if the Lambda function fails to fulfill the intent. 720 DialogState *string `location:"header" locationName:"x-amz-lex-dialog-state" type:"string" enum:"DialogState"` 721 722 // The text used to process the request. 723 // 724 // If the input was an audio stream, the inputTranscript field contains the 725 // text extracted from the audio stream. This is the text that is actually processed 726 // to recognize intents and slot values. You can use this information to determine 727 // if Amazon Lex is correctly processing the audio that you send. 728 InputTranscript *string `location:"header" locationName:"x-amz-lex-input-transcript" type:"string"` 729 730 // Current user intent that Amazon Lex is aware of. 731 IntentName *string `location:"header" locationName:"x-amz-lex-intent-name" type:"string"` 732 733 // The message to convey to the user. The message can come from the bot's configuration 734 // or from a Lambda function. 735 // 736 // If the intent is not configured with a Lambda function, or if the Lambda 737 // function returned Delegate as the dialogAction.type its response, Amazon 738 // Lex decides on the next course of action and selects an appropriate message 739 // from the bot's configuration based on the current interaction context. For 740 // example, if Amazon Lex isn't able to understand user input, it uses a clarification 741 // prompt message. 742 // 743 // When you create an intent you can assign messages to groups. When messages 744 // are assigned to groups Amazon Lex returns one message from each group in 745 // the response. The message field is an escaped JSON string containing the 746 // messages. For more information about the structure of the JSON string returned, 747 // see msg-prompts-formats. 748 // 749 // If the Lambda function returns a message, Amazon Lex passes it to the client 750 // in its response. 751 Message *string `location:"header" locationName:"x-amz-lex-message" min:"1" type:"string"` 752 753 // The format of the response message. One of the following values: 754 // 755 // * PlainText - The message contains plain UTF-8 text. 756 // 757 // * CustomPayload - The message is a custom format for the client. 758 // 759 // * SSML - The message contains text formatted for voice output. 760 // 761 // * Composite - The message contains an escaped JSON object containing one 762 // or more messages from the groups that messages were assigned to when the 763 // intent was created. 764 MessageFormat *string `location:"header" locationName:"x-amz-lex-message-format" type:"string" enum:"MessageFormatType"` 765 766 // Map of key/value pairs representing the session-specific context information. 767 SessionAttributes aws.JSONValue `location:"header" locationName:"x-amz-lex-session-attributes" type:"jsonvalue"` 768 769 // If the dialogState value is ElicitSlot, returns the name of the slot for 770 // which Amazon Lex is eliciting a value. 771 SlotToElicit *string `location:"header" locationName:"x-amz-lex-slot-to-elicit" type:"string"` 772 773 // Map of zero or more intent slots (name/value pairs) Amazon Lex detected from 774 // the user input during the conversation. 775 // 776 // Amazon Lex creates a resolution list containing likely values for a slot. 777 // The value that it returns is determined by the valueSelectionStrategy selected 778 // when the slot type was created or updated. If valueSelectionStrategy is set 779 // to ORIGINAL_VALUE, the value provided by the user is returned, if the user 780 // value is similar to the slot values. If valueSelectionStrategy is set to 781 // TOP_RESOLUTION Amazon Lex returns the first value in the resolution list 782 // or, if there is no resolution list, null. If you don't specify a valueSelectionStrategy, 783 // the default is ORIGINAL_VALUE. 784 Slots aws.JSONValue `location:"header" locationName:"x-amz-lex-slots" type:"jsonvalue"` 785} 786 787// String returns the string representation 788func (s PostContentOutput) String() string { 789 return awsutil.Prettify(s) 790} 791 792// GoString returns the string representation 793func (s PostContentOutput) GoString() string { 794 return s.String() 795} 796 797// SetAudioStream sets the AudioStream field's value. 798func (s *PostContentOutput) SetAudioStream(v io.ReadCloser) *PostContentOutput { 799 s.AudioStream = v 800 return s 801} 802 803// SetContentType sets the ContentType field's value. 804func (s *PostContentOutput) SetContentType(v string) *PostContentOutput { 805 s.ContentType = &v 806 return s 807} 808 809// SetDialogState sets the DialogState field's value. 810func (s *PostContentOutput) SetDialogState(v string) *PostContentOutput { 811 s.DialogState = &v 812 return s 813} 814 815// SetInputTranscript sets the InputTranscript field's value. 816func (s *PostContentOutput) SetInputTranscript(v string) *PostContentOutput { 817 s.InputTranscript = &v 818 return s 819} 820 821// SetIntentName sets the IntentName field's value. 822func (s *PostContentOutput) SetIntentName(v string) *PostContentOutput { 823 s.IntentName = &v 824 return s 825} 826 827// SetMessage sets the Message field's value. 828func (s *PostContentOutput) SetMessage(v string) *PostContentOutput { 829 s.Message = &v 830 return s 831} 832 833// SetMessageFormat sets the MessageFormat field's value. 834func (s *PostContentOutput) SetMessageFormat(v string) *PostContentOutput { 835 s.MessageFormat = &v 836 return s 837} 838 839// SetSessionAttributes sets the SessionAttributes field's value. 840func (s *PostContentOutput) SetSessionAttributes(v aws.JSONValue) *PostContentOutput { 841 s.SessionAttributes = v 842 return s 843} 844 845// SetSlotToElicit sets the SlotToElicit field's value. 846func (s *PostContentOutput) SetSlotToElicit(v string) *PostContentOutput { 847 s.SlotToElicit = &v 848 return s 849} 850 851// SetSlots sets the Slots field's value. 852func (s *PostContentOutput) SetSlots(v aws.JSONValue) *PostContentOutput { 853 s.Slots = v 854 return s 855} 856 857type PostTextInput struct { 858 _ struct{} `type:"structure"` 859 860 // The alias of the Amazon Lex bot. 861 // 862 // BotAlias is a required field 863 BotAlias *string `location:"uri" locationName:"botAlias" type:"string" required:"true"` 864 865 // The name of the Amazon Lex bot. 866 // 867 // BotName is a required field 868 BotName *string `location:"uri" locationName:"botName" type:"string" required:"true"` 869 870 // The text that the user entered (Amazon Lex interprets this text). 871 // 872 // InputText is a required field 873 InputText *string `locationName:"inputText" min:"1" type:"string" required:"true"` 874 875 // Request-specific information passed between Amazon Lex and a client application. 876 // 877 // The namespace x-amz-lex: is reserved for special attributes. Don't create 878 // any request attributes with the prefix x-amz-lex:. 879 // 880 // For more information, see Setting Request Attributes (http://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html#context-mgmt-request-attribs). 881 RequestAttributes map[string]*string `locationName:"requestAttributes" type:"map"` 882 883 // Application-specific information passed between Amazon Lex and a client application. 884 // 885 // For more information, see Setting Session Attributes (http://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html#context-mgmt-session-attribs). 886 SessionAttributes map[string]*string `locationName:"sessionAttributes" type:"map"` 887 888 // The ID of the client application user. Amazon Lex uses this to identify a 889 // user's conversation with your bot. At runtime, each request must contain 890 // the userID field. 891 // 892 // To decide the user ID to use for your application, consider the following 893 // factors. 894 // 895 // * The userID field must not contain any personally identifiable information 896 // of the user, for example, name, personal identification numbers, or other 897 // end user personal information. 898 // 899 // * If you want a user to start a conversation on one device and continue 900 // on another device, use a user-specific identifier. 901 // 902 // * If you want the same user to be able to have two independent conversations 903 // on two different devices, choose a device-specific identifier. 904 // 905 // * A user can't have two independent conversations with two different versions 906 // of the same bot. For example, a user can't have a conversation with the 907 // PROD and BETA versions of the same bot. If you anticipate that a user 908 // will need to have conversation with two different versions, for example, 909 // while testing, include the bot alias in the user ID to separate the two 910 // conversations. 911 // 912 // UserId is a required field 913 UserId *string `location:"uri" locationName:"userId" min:"2" type:"string" required:"true"` 914} 915 916// String returns the string representation 917func (s PostTextInput) String() string { 918 return awsutil.Prettify(s) 919} 920 921// GoString returns the string representation 922func (s PostTextInput) GoString() string { 923 return s.String() 924} 925 926// Validate inspects the fields of the type to determine if they are valid. 927func (s *PostTextInput) Validate() error { 928 invalidParams := request.ErrInvalidParams{Context: "PostTextInput"} 929 if s.BotAlias == nil { 930 invalidParams.Add(request.NewErrParamRequired("BotAlias")) 931 } 932 if s.BotName == nil { 933 invalidParams.Add(request.NewErrParamRequired("BotName")) 934 } 935 if s.InputText == nil { 936 invalidParams.Add(request.NewErrParamRequired("InputText")) 937 } 938 if s.InputText != nil && len(*s.InputText) < 1 { 939 invalidParams.Add(request.NewErrParamMinLen("InputText", 1)) 940 } 941 if s.UserId == nil { 942 invalidParams.Add(request.NewErrParamRequired("UserId")) 943 } 944 if s.UserId != nil && len(*s.UserId) < 2 { 945 invalidParams.Add(request.NewErrParamMinLen("UserId", 2)) 946 } 947 948 if invalidParams.Len() > 0 { 949 return invalidParams 950 } 951 return nil 952} 953 954// SetBotAlias sets the BotAlias field's value. 955func (s *PostTextInput) SetBotAlias(v string) *PostTextInput { 956 s.BotAlias = &v 957 return s 958} 959 960// SetBotName sets the BotName field's value. 961func (s *PostTextInput) SetBotName(v string) *PostTextInput { 962 s.BotName = &v 963 return s 964} 965 966// SetInputText sets the InputText field's value. 967func (s *PostTextInput) SetInputText(v string) *PostTextInput { 968 s.InputText = &v 969 return s 970} 971 972// SetRequestAttributes sets the RequestAttributes field's value. 973func (s *PostTextInput) SetRequestAttributes(v map[string]*string) *PostTextInput { 974 s.RequestAttributes = v 975 return s 976} 977 978// SetSessionAttributes sets the SessionAttributes field's value. 979func (s *PostTextInput) SetSessionAttributes(v map[string]*string) *PostTextInput { 980 s.SessionAttributes = v 981 return s 982} 983 984// SetUserId sets the UserId field's value. 985func (s *PostTextInput) SetUserId(v string) *PostTextInput { 986 s.UserId = &v 987 return s 988} 989 990type PostTextOutput struct { 991 _ struct{} `type:"structure"` 992 993 // Identifies the current state of the user interaction. Amazon Lex returns 994 // one of the following values as dialogState. The client can optionally use 995 // this information to customize the user interface. 996 // 997 // * ElicitIntent - Amazon Lex wants to elicit user intent. 998 // 999 // For example, a user might utter an intent ("I want to order a pizza"). If 1000 // Amazon Lex cannot infer the user intent from this utterance, it will return 1001 // this dialogState. 1002 // 1003 // * ConfirmIntent - Amazon Lex is expecting a "yes" or "no" response. 1004 // 1005 // For example, Amazon Lex wants user confirmation before fulfilling an intent. 1006 // 1007 // 1008 // Instead of a simple "yes" or "no," a user might respond with additional information. 1009 // For example, "yes, but make it thick crust pizza" or "no, I want to order 1010 // a drink". Amazon Lex can process such additional information (in these 1011 // examples, update the crust type slot value, or change intent from OrderPizza 1012 // to OrderDrink). 1013 // 1014 // * ElicitSlot - Amazon Lex is expecting a slot value for the current intent. 1015 // 1016 // 1017 // For example, suppose that in the response Amazon Lex sends this message: 1018 // "What size pizza would you like?". A user might reply with the slot value 1019 // (e.g., "medium"). The user might also provide additional information in 1020 // the response (e.g., "medium thick crust pizza"). Amazon Lex can process 1021 // such additional information appropriately. 1022 // 1023 // * Fulfilled - Conveys that the Lambda function configured for the intent 1024 // has successfully fulfilled the intent. 1025 // 1026 // * ReadyForFulfillment - Conveys that the client has to fulfill the intent. 1027 // 1028 // 1029 // * Failed - Conveys that the conversation with the user failed. 1030 // 1031 // This can happen for various reasons including that the user did not provide 1032 // an appropriate response to prompts from the service (you can configure 1033 // how many times Amazon Lex can prompt a user for specific information), 1034 // or the Lambda function failed to fulfill the intent. 1035 DialogState *string `locationName:"dialogState" type:"string" enum:"DialogState"` 1036 1037 // The current user intent that Amazon Lex is aware of. 1038 IntentName *string `locationName:"intentName" type:"string"` 1039 1040 // The message to convey to the user. The message can come from the bot's configuration 1041 // or from a Lambda function. 1042 // 1043 // If the intent is not configured with a Lambda function, or if the Lambda 1044 // function returned Delegate as the dialogAction.type its response, Amazon 1045 // Lex decides on the next course of action and selects an appropriate message 1046 // from the bot's configuration based on the current interaction context. For 1047 // example, if Amazon Lex isn't able to understand user input, it uses a clarification 1048 // prompt message. 1049 // 1050 // When you create an intent you can assign messages to groups. When messages 1051 // are assigned to groups Amazon Lex returns one message from each group in 1052 // the response. The message field is an escaped JSON string containing the 1053 // messages. For more information about the structure of the JSON string returned, 1054 // see msg-prompts-formats. 1055 // 1056 // If the Lambda function returns a message, Amazon Lex passes it to the client 1057 // in its response. 1058 Message *string `locationName:"message" min:"1" type:"string"` 1059 1060 // The format of the response message. One of the following values: 1061 // 1062 // * PlainText - The message contains plain UTF-8 text. 1063 // 1064 // * CustomPayload - The message is a custom format defined by the Lambda 1065 // function. 1066 // 1067 // * SSML - The message contains text formatted for voice output. 1068 // 1069 // * Composite - The message contains an escaped JSON object containing one 1070 // or more messages from the groups that messages were assigned to when the 1071 // intent was created. 1072 MessageFormat *string `locationName:"messageFormat" type:"string" enum:"MessageFormatType"` 1073 1074 // Represents the options that the user has to respond to the current prompt. 1075 // Response Card can come from the bot configuration (in the Amazon Lex console, 1076 // choose the settings button next to a slot) or from a code hook (Lambda function). 1077 ResponseCard *ResponseCard `locationName:"responseCard" type:"structure"` 1078 1079 // A map of key-value pairs representing the session-specific context information. 1080 SessionAttributes map[string]*string `locationName:"sessionAttributes" type:"map"` 1081 1082 // If the dialogState value is ElicitSlot, returns the name of the slot for 1083 // which Amazon Lex is eliciting a value. 1084 SlotToElicit *string `locationName:"slotToElicit" type:"string"` 1085 1086 // The intent slots that Amazon Lex detected from the user input in the conversation. 1087 // 1088 // Amazon Lex creates a resolution list containing likely values for a slot. 1089 // The value that it returns is determined by the valueSelectionStrategy selected 1090 // when the slot type was created or updated. If valueSelectionStrategy is set 1091 // to ORIGINAL_VALUE, the value provided by the user is returned, if the user 1092 // value is similar to the slot values. If valueSelectionStrategy is set to 1093 // TOP_RESOLUTION Amazon Lex returns the first value in the resolution list 1094 // or, if there is no resolution list, null. If you don't specify a valueSelectionStrategy, 1095 // the default is ORIGINAL_VALUE. 1096 Slots map[string]*string `locationName:"slots" type:"map"` 1097} 1098 1099// String returns the string representation 1100func (s PostTextOutput) String() string { 1101 return awsutil.Prettify(s) 1102} 1103 1104// GoString returns the string representation 1105func (s PostTextOutput) GoString() string { 1106 return s.String() 1107} 1108 1109// SetDialogState sets the DialogState field's value. 1110func (s *PostTextOutput) SetDialogState(v string) *PostTextOutput { 1111 s.DialogState = &v 1112 return s 1113} 1114 1115// SetIntentName sets the IntentName field's value. 1116func (s *PostTextOutput) SetIntentName(v string) *PostTextOutput { 1117 s.IntentName = &v 1118 return s 1119} 1120 1121// SetMessage sets the Message field's value. 1122func (s *PostTextOutput) SetMessage(v string) *PostTextOutput { 1123 s.Message = &v 1124 return s 1125} 1126 1127// SetMessageFormat sets the MessageFormat field's value. 1128func (s *PostTextOutput) SetMessageFormat(v string) *PostTextOutput { 1129 s.MessageFormat = &v 1130 return s 1131} 1132 1133// SetResponseCard sets the ResponseCard field's value. 1134func (s *PostTextOutput) SetResponseCard(v *ResponseCard) *PostTextOutput { 1135 s.ResponseCard = v 1136 return s 1137} 1138 1139// SetSessionAttributes sets the SessionAttributes field's value. 1140func (s *PostTextOutput) SetSessionAttributes(v map[string]*string) *PostTextOutput { 1141 s.SessionAttributes = v 1142 return s 1143} 1144 1145// SetSlotToElicit sets the SlotToElicit field's value. 1146func (s *PostTextOutput) SetSlotToElicit(v string) *PostTextOutput { 1147 s.SlotToElicit = &v 1148 return s 1149} 1150 1151// SetSlots sets the Slots field's value. 1152func (s *PostTextOutput) SetSlots(v map[string]*string) *PostTextOutput { 1153 s.Slots = v 1154 return s 1155} 1156 1157// If you configure a response card when creating your bots, Amazon Lex substitutes 1158// the session attributes and slot values that are available, and then returns 1159// it. The response card can also come from a Lambda function ( dialogCodeHook 1160// and fulfillmentActivity on an intent). 1161type ResponseCard struct { 1162 _ struct{} `type:"structure"` 1163 1164 // The content type of the response. 1165 ContentType *string `locationName:"contentType" type:"string" enum:"ContentType"` 1166 1167 // An array of attachment objects representing options. 1168 GenericAttachments []*GenericAttachment `locationName:"genericAttachments" type:"list"` 1169 1170 // The version of the response card format. 1171 Version *string `locationName:"version" type:"string"` 1172} 1173 1174// String returns the string representation 1175func (s ResponseCard) String() string { 1176 return awsutil.Prettify(s) 1177} 1178 1179// GoString returns the string representation 1180func (s ResponseCard) GoString() string { 1181 return s.String() 1182} 1183 1184// SetContentType sets the ContentType field's value. 1185func (s *ResponseCard) SetContentType(v string) *ResponseCard { 1186 s.ContentType = &v 1187 return s 1188} 1189 1190// SetGenericAttachments sets the GenericAttachments field's value. 1191func (s *ResponseCard) SetGenericAttachments(v []*GenericAttachment) *ResponseCard { 1192 s.GenericAttachments = v 1193 return s 1194} 1195 1196// SetVersion sets the Version field's value. 1197func (s *ResponseCard) SetVersion(v string) *ResponseCard { 1198 s.Version = &v 1199 return s 1200} 1201 1202const ( 1203 // ContentTypeApplicationVndAmazonawsCardGeneric is a ContentType enum value 1204 ContentTypeApplicationVndAmazonawsCardGeneric = "application/vnd.amazonaws.card.generic" 1205) 1206 1207const ( 1208 // DialogStateElicitIntent is a DialogState enum value 1209 DialogStateElicitIntent = "ElicitIntent" 1210 1211 // DialogStateConfirmIntent is a DialogState enum value 1212 DialogStateConfirmIntent = "ConfirmIntent" 1213 1214 // DialogStateElicitSlot is a DialogState enum value 1215 DialogStateElicitSlot = "ElicitSlot" 1216 1217 // DialogStateFulfilled is a DialogState enum value 1218 DialogStateFulfilled = "Fulfilled" 1219 1220 // DialogStateReadyForFulfillment is a DialogState enum value 1221 DialogStateReadyForFulfillment = "ReadyForFulfillment" 1222 1223 // DialogStateFailed is a DialogState enum value 1224 DialogStateFailed = "Failed" 1225) 1226 1227const ( 1228 // MessageFormatTypePlainText is a MessageFormatType enum value 1229 MessageFormatTypePlainText = "PlainText" 1230 1231 // MessageFormatTypeCustomPayload is a MessageFormatType enum value 1232 MessageFormatTypeCustomPayload = "CustomPayload" 1233 1234 // MessageFormatTypeSsml is a MessageFormatType enum value 1235 MessageFormatTypeSsml = "SSML" 1236 1237 // MessageFormatTypeComposite is a MessageFormatType enum value 1238 MessageFormatTypeComposite = "Composite" 1239) 1240