1// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 3package lexruntimev2 4 5import ( 6 "bytes" 7 "fmt" 8 "io" 9 "sync" 10 "time" 11 12 "github.com/aws/aws-sdk-go/aws" 13 "github.com/aws/aws-sdk-go/aws/awserr" 14 "github.com/aws/aws-sdk-go/aws/awsutil" 15 "github.com/aws/aws-sdk-go/aws/client" 16 "github.com/aws/aws-sdk-go/aws/request" 17 "github.com/aws/aws-sdk-go/aws/signer/v4" 18 "github.com/aws/aws-sdk-go/private/protocol" 19 "github.com/aws/aws-sdk-go/private/protocol/eventstream" 20 "github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi" 21 "github.com/aws/aws-sdk-go/private/protocol/rest" 22 "github.com/aws/aws-sdk-go/private/protocol/restjson" 23) 24 25const opDeleteSession = "DeleteSession" 26 27// DeleteSessionRequest generates a "aws/request.Request" representing the 28// client's request for the DeleteSession operation. The "output" return 29// value will be populated with the request's response once the request completes 30// successfully. 31// 32// Use "Send" method on the returned Request to send the API call to the service. 33// the "output" return value is not valid until after Send returns without error. 34// 35// See DeleteSession for more information on using the DeleteSession 36// API call, and error handling. 37// 38// This method is useful when you want to inject custom logic or configuration 39// into the SDK's request lifecycle. Such as custom headers, or retry logic. 40// 41// 42// // Example sending a request using the DeleteSessionRequest method. 43// req, resp := client.DeleteSessionRequest(params) 44// 45// err := req.Send() 46// if err == nil { // resp is now filled 47// fmt.Println(resp) 48// } 49// 50// See also, https://docs.aws.amazon.com/goto/WebAPI/runtime.lex.v2-2020-08-07/DeleteSession 51func (c *LexRuntimeV2) DeleteSessionRequest(input *DeleteSessionInput) (req *request.Request, output *DeleteSessionOutput) { 52 op := &request.Operation{ 53 Name: opDeleteSession, 54 HTTPMethod: "DELETE", 55 HTTPPath: "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}", 56 } 57 58 if input == nil { 59 input = &DeleteSessionInput{} 60 } 61 62 output = &DeleteSessionOutput{} 63 req = c.newRequest(op, input, output) 64 return 65} 66 67// DeleteSession API operation for Amazon Lex Runtime V2. 68// 69// Removes session information for a specified bot, alias, and user ID. 70// 71// You can use this operation to restart a conversation with a bot. When you 72// remove a session, the entire history of the session is removed so that you 73// can start again. 74// 75// You don't need to delete a session. Sessions have a time limit and will expire. 76// Set the session time limit when you create the bot. The default is 5 minutes, 77// but you can specify anything between 1 minute and 24 hours. 78// 79// If you specify a bot or alias ID that doesn't exist, you receive a BadRequestException. 80// 81// If the locale doesn't exist in the bot, or if the locale hasn't been enables 82// for the alias, you receive a BadRequestException. 83// 84// Returns awserr.Error for service API and SDK errors. Use runtime type assertions 85// with awserr.Error's Code and Message methods to get detailed information about 86// the error. 87// 88// See the AWS API reference guide for Amazon Lex Runtime V2's 89// API operation DeleteSession for usage and error information. 90// 91// Returned Error Types: 92// * AccessDeniedException 93// 94// * ResourceNotFoundException 95// 96// * ValidationException 97// 98// * ThrottlingException 99// 100// * InternalServerException 101// 102// * ConflictException 103// 104// See also, https://docs.aws.amazon.com/goto/WebAPI/runtime.lex.v2-2020-08-07/DeleteSession 105func (c *LexRuntimeV2) DeleteSession(input *DeleteSessionInput) (*DeleteSessionOutput, error) { 106 req, out := c.DeleteSessionRequest(input) 107 return out, req.Send() 108} 109 110// DeleteSessionWithContext is the same as DeleteSession with the addition of 111// the ability to pass a context and additional request options. 112// 113// See DeleteSession for details on how to use this API operation. 114// 115// The context must be non-nil and will be used for request cancellation. If 116// the context is nil a panic will occur. In the future the SDK may create 117// sub-contexts for http.Requests. See https://golang.org/pkg/context/ 118// for more information on using Contexts. 119func (c *LexRuntimeV2) DeleteSessionWithContext(ctx aws.Context, input *DeleteSessionInput, opts ...request.Option) (*DeleteSessionOutput, error) { 120 req, out := c.DeleteSessionRequest(input) 121 req.SetContext(ctx) 122 req.ApplyOptions(opts...) 123 return out, req.Send() 124} 125 126const opGetSession = "GetSession" 127 128// GetSessionRequest generates a "aws/request.Request" representing the 129// client's request for the GetSession operation. The "output" return 130// value will be populated with the request's response once the request completes 131// successfully. 132// 133// Use "Send" method on the returned Request to send the API call to the service. 134// the "output" return value is not valid until after Send returns without error. 135// 136// See GetSession for more information on using the GetSession 137// API call, and error handling. 138// 139// This method is useful when you want to inject custom logic or configuration 140// into the SDK's request lifecycle. Such as custom headers, or retry logic. 141// 142// 143// // Example sending a request using the GetSessionRequest method. 144// req, resp := client.GetSessionRequest(params) 145// 146// err := req.Send() 147// if err == nil { // resp is now filled 148// fmt.Println(resp) 149// } 150// 151// See also, https://docs.aws.amazon.com/goto/WebAPI/runtime.lex.v2-2020-08-07/GetSession 152func (c *LexRuntimeV2) GetSessionRequest(input *GetSessionInput) (req *request.Request, output *GetSessionOutput) { 153 op := &request.Operation{ 154 Name: opGetSession, 155 HTTPMethod: "GET", 156 HTTPPath: "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}", 157 } 158 159 if input == nil { 160 input = &GetSessionInput{} 161 } 162 163 output = &GetSessionOutput{} 164 req = c.newRequest(op, input, output) 165 return 166} 167 168// GetSession API operation for Amazon Lex Runtime V2. 169// 170// Returns session information for a specified bot, alias, and user. 171// 172// For example, you can use this operation to retrieve session information for 173// a user that has left a long-running session in use. 174// 175// If the bot, alias, or session identifier doesn't exist, Amazon Lex returns 176// a BadRequestException. If the locale doesn't exist or is not enabled for 177// the alias, you receive a BadRequestException. 178// 179// Returns awserr.Error for service API and SDK errors. Use runtime type assertions 180// with awserr.Error's Code and Message methods to get detailed information about 181// the error. 182// 183// See the AWS API reference guide for Amazon Lex Runtime V2's 184// API operation GetSession for usage and error information. 185// 186// Returned Error Types: 187// * AccessDeniedException 188// 189// * ResourceNotFoundException 190// 191// * ValidationException 192// 193// * ThrottlingException 194// 195// * InternalServerException 196// 197// See also, https://docs.aws.amazon.com/goto/WebAPI/runtime.lex.v2-2020-08-07/GetSession 198func (c *LexRuntimeV2) GetSession(input *GetSessionInput) (*GetSessionOutput, error) { 199 req, out := c.GetSessionRequest(input) 200 return out, req.Send() 201} 202 203// GetSessionWithContext is the same as GetSession with the addition of 204// the ability to pass a context and additional request options. 205// 206// See GetSession for details on how to use this API operation. 207// 208// The context must be non-nil and will be used for request cancellation. If 209// the context is nil a panic will occur. In the future the SDK may create 210// sub-contexts for http.Requests. See https://golang.org/pkg/context/ 211// for more information on using Contexts. 212func (c *LexRuntimeV2) GetSessionWithContext(ctx aws.Context, input *GetSessionInput, opts ...request.Option) (*GetSessionOutput, error) { 213 req, out := c.GetSessionRequest(input) 214 req.SetContext(ctx) 215 req.ApplyOptions(opts...) 216 return out, req.Send() 217} 218 219const opPutSession = "PutSession" 220 221// PutSessionRequest generates a "aws/request.Request" representing the 222// client's request for the PutSession operation. The "output" return 223// value will be populated with the request's response once the request completes 224// successfully. 225// 226// Use "Send" method on the returned Request to send the API call to the service. 227// the "output" return value is not valid until after Send returns without error. 228// 229// See PutSession for more information on using the PutSession 230// API call, and error handling. 231// 232// This method is useful when you want to inject custom logic or configuration 233// into the SDK's request lifecycle. Such as custom headers, or retry logic. 234// 235// 236// // Example sending a request using the PutSessionRequest method. 237// req, resp := client.PutSessionRequest(params) 238// 239// err := req.Send() 240// if err == nil { // resp is now filled 241// fmt.Println(resp) 242// } 243// 244// See also, https://docs.aws.amazon.com/goto/WebAPI/runtime.lex.v2-2020-08-07/PutSession 245func (c *LexRuntimeV2) PutSessionRequest(input *PutSessionInput) (req *request.Request, output *PutSessionOutput) { 246 op := &request.Operation{ 247 Name: opPutSession, 248 HTTPMethod: "POST", 249 HTTPPath: "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}", 250 } 251 252 if input == nil { 253 input = &PutSessionInput{} 254 } 255 256 output = &PutSessionOutput{} 257 req = c.newRequest(op, input, output) 258 return 259} 260 261// PutSession API operation for Amazon Lex Runtime V2. 262// 263// Creates a new session or modifies an existing session with an Amazon Lex 264// bot. Use this operation to enable your application to set the state of the 265// bot. 266// 267// Returns awserr.Error for service API and SDK errors. Use runtime type assertions 268// with awserr.Error's Code and Message methods to get detailed information about 269// the error. 270// 271// See the AWS API reference guide for Amazon Lex Runtime V2's 272// API operation PutSession for usage and error information. 273// 274// Returned Error Types: 275// * AccessDeniedException 276// 277// * ResourceNotFoundException 278// 279// * ValidationException 280// 281// * ThrottlingException 282// 283// * InternalServerException 284// 285// * ConflictException 286// 287// * DependencyFailedException 288// 289// * BadGatewayException 290// 291// See also, https://docs.aws.amazon.com/goto/WebAPI/runtime.lex.v2-2020-08-07/PutSession 292func (c *LexRuntimeV2) PutSession(input *PutSessionInput) (*PutSessionOutput, error) { 293 req, out := c.PutSessionRequest(input) 294 return out, req.Send() 295} 296 297// PutSessionWithContext is the same as PutSession with the addition of 298// the ability to pass a context and additional request options. 299// 300// See PutSession for details on how to use this API operation. 301// 302// The context must be non-nil and will be used for request cancellation. If 303// the context is nil a panic will occur. In the future the SDK may create 304// sub-contexts for http.Requests. See https://golang.org/pkg/context/ 305// for more information on using Contexts. 306func (c *LexRuntimeV2) PutSessionWithContext(ctx aws.Context, input *PutSessionInput, opts ...request.Option) (*PutSessionOutput, error) { 307 req, out := c.PutSessionRequest(input) 308 req.SetContext(ctx) 309 req.ApplyOptions(opts...) 310 return out, req.Send() 311} 312 313const opRecognizeText = "RecognizeText" 314 315// RecognizeTextRequest generates a "aws/request.Request" representing the 316// client's request for the RecognizeText operation. The "output" return 317// value will be populated with the request's response once the request completes 318// successfully. 319// 320// Use "Send" method on the returned Request to send the API call to the service. 321// the "output" return value is not valid until after Send returns without error. 322// 323// See RecognizeText for more information on using the RecognizeText 324// API call, and error handling. 325// 326// This method is useful when you want to inject custom logic or configuration 327// into the SDK's request lifecycle. Such as custom headers, or retry logic. 328// 329// 330// // Example sending a request using the RecognizeTextRequest method. 331// req, resp := client.RecognizeTextRequest(params) 332// 333// err := req.Send() 334// if err == nil { // resp is now filled 335// fmt.Println(resp) 336// } 337// 338// See also, https://docs.aws.amazon.com/goto/WebAPI/runtime.lex.v2-2020-08-07/RecognizeText 339func (c *LexRuntimeV2) RecognizeTextRequest(input *RecognizeTextInput) (req *request.Request, output *RecognizeTextOutput) { 340 op := &request.Operation{ 341 Name: opRecognizeText, 342 HTTPMethod: "POST", 343 HTTPPath: "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/text", 344 } 345 346 if input == nil { 347 input = &RecognizeTextInput{} 348 } 349 350 output = &RecognizeTextOutput{} 351 req = c.newRequest(op, input, output) 352 return 353} 354 355// RecognizeText API operation for Amazon Lex Runtime V2. 356// 357// Sends user input to Amazon Lex. Client applications use this API to send 358// requests to Amazon Lex at runtime. Amazon Lex then interprets the user input 359// using the machine learning model that it build for the bot. 360// 361// In response, Amazon Lex returns the next message to convey to the user and 362// an optional response card to display. 363// 364// Returns awserr.Error for service API and SDK errors. Use runtime type assertions 365// with awserr.Error's Code and Message methods to get detailed information about 366// the error. 367// 368// See the AWS API reference guide for Amazon Lex Runtime V2's 369// API operation RecognizeText for usage and error information. 370// 371// Returned Error Types: 372// * AccessDeniedException 373// 374// * ResourceNotFoundException 375// 376// * ValidationException 377// 378// * ThrottlingException 379// 380// * InternalServerException 381// 382// * ConflictException 383// 384// * DependencyFailedException 385// 386// * BadGatewayException 387// 388// See also, https://docs.aws.amazon.com/goto/WebAPI/runtime.lex.v2-2020-08-07/RecognizeText 389func (c *LexRuntimeV2) RecognizeText(input *RecognizeTextInput) (*RecognizeTextOutput, error) { 390 req, out := c.RecognizeTextRequest(input) 391 return out, req.Send() 392} 393 394// RecognizeTextWithContext is the same as RecognizeText with the addition of 395// the ability to pass a context and additional request options. 396// 397// See RecognizeText for details on how to use this API operation. 398// 399// The context must be non-nil and will be used for request cancellation. If 400// the context is nil a panic will occur. In the future the SDK may create 401// sub-contexts for http.Requests. See https://golang.org/pkg/context/ 402// for more information on using Contexts. 403func (c *LexRuntimeV2) RecognizeTextWithContext(ctx aws.Context, input *RecognizeTextInput, opts ...request.Option) (*RecognizeTextOutput, error) { 404 req, out := c.RecognizeTextRequest(input) 405 req.SetContext(ctx) 406 req.ApplyOptions(opts...) 407 return out, req.Send() 408} 409 410const opRecognizeUtterance = "RecognizeUtterance" 411 412// RecognizeUtteranceRequest generates a "aws/request.Request" representing the 413// client's request for the RecognizeUtterance operation. The "output" return 414// value will be populated with the request's response once the request completes 415// successfully. 416// 417// Use "Send" method on the returned Request to send the API call to the service. 418// the "output" return value is not valid until after Send returns without error. 419// 420// See RecognizeUtterance for more information on using the RecognizeUtterance 421// API call, and error handling. 422// 423// This method is useful when you want to inject custom logic or configuration 424// into the SDK's request lifecycle. Such as custom headers, or retry logic. 425// 426// 427// // Example sending a request using the RecognizeUtteranceRequest method. 428// req, resp := client.RecognizeUtteranceRequest(params) 429// 430// err := req.Send() 431// if err == nil { // resp is now filled 432// fmt.Println(resp) 433// } 434// 435// See also, https://docs.aws.amazon.com/goto/WebAPI/runtime.lex.v2-2020-08-07/RecognizeUtterance 436func (c *LexRuntimeV2) RecognizeUtteranceRequest(input *RecognizeUtteranceInput) (req *request.Request, output *RecognizeUtteranceOutput) { 437 op := &request.Operation{ 438 Name: opRecognizeUtterance, 439 HTTPMethod: "POST", 440 HTTPPath: "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/utterance", 441 } 442 443 if input == nil { 444 input = &RecognizeUtteranceInput{} 445 } 446 447 output = &RecognizeUtteranceOutput{} 448 req = c.newRequest(op, input, output) 449 req.Handlers.Sign.Remove(v4.SignRequestHandler) 450 handler := v4.BuildNamedHandler("v4.CustomSignerHandler", v4.WithUnsignedPayload) 451 req.Handlers.Sign.PushFrontNamed(handler) 452 return 453} 454 455// RecognizeUtterance API operation for Amazon Lex Runtime V2. 456// 457// Sends user input to Amazon Lex. You can send text or speech. Clients use 458// this API to send text and audio requests to Amazon Lex at runtime. Amazon 459// Lex interprets the user input using the machine learning model built for 460// the bot. 461// 462// Returns awserr.Error for service API and SDK errors. Use runtime type assertions 463// with awserr.Error's Code and Message methods to get detailed information about 464// the error. 465// 466// See the AWS API reference guide for Amazon Lex Runtime V2's 467// API operation RecognizeUtterance for usage and error information. 468// 469// Returned Error Types: 470// * AccessDeniedException 471// 472// * ResourceNotFoundException 473// 474// * ValidationException 475// 476// * ThrottlingException 477// 478// * InternalServerException 479// 480// * ConflictException 481// 482// * DependencyFailedException 483// 484// * BadGatewayException 485// 486// See also, https://docs.aws.amazon.com/goto/WebAPI/runtime.lex.v2-2020-08-07/RecognizeUtterance 487func (c *LexRuntimeV2) RecognizeUtterance(input *RecognizeUtteranceInput) (*RecognizeUtteranceOutput, error) { 488 req, out := c.RecognizeUtteranceRequest(input) 489 return out, req.Send() 490} 491 492// RecognizeUtteranceWithContext is the same as RecognizeUtterance with the addition of 493// the ability to pass a context and additional request options. 494// 495// See RecognizeUtterance for details on how to use this API operation. 496// 497// The context must be non-nil and will be used for request cancellation. If 498// the context is nil a panic will occur. In the future the SDK may create 499// sub-contexts for http.Requests. See https://golang.org/pkg/context/ 500// for more information on using Contexts. 501func (c *LexRuntimeV2) RecognizeUtteranceWithContext(ctx aws.Context, input *RecognizeUtteranceInput, opts ...request.Option) (*RecognizeUtteranceOutput, error) { 502 req, out := c.RecognizeUtteranceRequest(input) 503 req.SetContext(ctx) 504 req.ApplyOptions(opts...) 505 return out, req.Send() 506} 507 508const opStartConversation = "StartConversation" 509 510// StartConversationRequest generates a "aws/request.Request" representing the 511// client's request for the StartConversation operation. The "output" return 512// value will be populated with the request's response once the request completes 513// successfully. 514// 515// Use "Send" method on the returned Request to send the API call to the service. 516// the "output" return value is not valid until after Send returns without error. 517// 518// See StartConversation for more information on using the StartConversation 519// API call, and error handling. 520// 521// This method is useful when you want to inject custom logic or configuration 522// into the SDK's request lifecycle. Such as custom headers, or retry logic. 523// 524// 525// // Example sending a request using the StartConversationRequest method. 526// req, resp := client.StartConversationRequest(params) 527// 528// err := req.Send() 529// if err == nil { // resp is now filled 530// fmt.Println(resp) 531// } 532// 533// See also, https://docs.aws.amazon.com/goto/WebAPI/runtime.lex.v2-2020-08-07/StartConversation 534func (c *LexRuntimeV2) StartConversationRequest(input *StartConversationInput) (req *request.Request, output *StartConversationOutput) { 535 op := &request.Operation{ 536 Name: opStartConversation, 537 HTTPMethod: "POST", 538 HTTPPath: "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/conversation", 539 } 540 541 if input == nil { 542 input = &StartConversationInput{} 543 } 544 545 output = &StartConversationOutput{} 546 req = c.newRequest(op, input, output) 547 req.Handlers.UnmarshalMeta.PushBack( 548 protocol.RequireHTTPMinProtocol{Major: 2}.Handler, 549 ) 550 551 es := NewStartConversationEventStream() 552 output.eventStream = es 553 554 req.Handlers.Sign.PushFront(es.setupInputPipe) 555 req.Handlers.UnmarshalError.PushBackNamed(request.NamedHandler{ 556 Name: "InputPipeCloser", 557 Fn: func(r *request.Request) { 558 err := es.closeInputPipe() 559 if err != nil { 560 r.Error = awserr.New(eventstreamapi.InputWriterCloseErrorCode, err.Error(), r.Error) 561 } 562 }, 563 }) 564 req.Handlers.Build.PushBack(request.WithSetRequestHeaders(map[string]string{ 565 "Content-Type": "application/vnd.amazon.eventstream", 566 "X-Amz-Content-Sha256": "STREAMING-AWS4-HMAC-SHA256-EVENTS", 567 })) 568 req.Handlers.Build.Swap(restjson.BuildHandler.Name, rest.BuildHandler) 569 req.Handlers.Send.Swap(client.LogHTTPRequestHandler.Name, client.LogHTTPRequestHeaderHandler) 570 req.Handlers.Unmarshal.PushBack(es.runInputStream) 571 572 req.Handlers.Send.Swap(client.LogHTTPResponseHandler.Name, client.LogHTTPResponseHeaderHandler) 573 req.Handlers.Unmarshal.Swap(restjson.UnmarshalHandler.Name, rest.UnmarshalHandler) 574 req.Handlers.Unmarshal.PushBack(es.runOutputStream) 575 req.Handlers.Unmarshal.PushBack(es.runOnStreamPartClose) 576 return 577} 578 579// StartConversation API operation for Amazon Lex Runtime V2. 580// 581// Starts an HTTP/2 bidirectional event stream that enables you to send audio, 582// text, or DTMF input in real time. After your application starts a conversation, 583// users send input to Amazon Lex as a stream of events. Amazon Lex processes 584// the incoming events and responds with streaming text or audio events. 585// 586// Returns awserr.Error for service API and SDK errors. Use runtime type assertions 587// with awserr.Error's Code and Message methods to get detailed information about 588// the error. 589// 590// See the AWS API reference guide for Amazon Lex Runtime V2's 591// API operation StartConversation for usage and error information. 592// 593// Returned Error Types: 594// * AccessDeniedException 595// 596// * ValidationException 597// 598// * ThrottlingException 599// 600// * InternalServerException 601// 602// See also, https://docs.aws.amazon.com/goto/WebAPI/runtime.lex.v2-2020-08-07/StartConversation 603func (c *LexRuntimeV2) StartConversation(input *StartConversationInput) (*StartConversationOutput, error) { 604 req, out := c.StartConversationRequest(input) 605 return out, req.Send() 606} 607 608// StartConversationWithContext is the same as StartConversation with the addition of 609// the ability to pass a context and additional request options. 610// 611// See StartConversation for details on how to use this API operation. 612// 613// The context must be non-nil and will be used for request cancellation. If 614// the context is nil a panic will occur. In the future the SDK may create 615// sub-contexts for http.Requests. See https://golang.org/pkg/context/ 616// for more information on using Contexts. 617func (c *LexRuntimeV2) StartConversationWithContext(ctx aws.Context, input *StartConversationInput, opts ...request.Option) (*StartConversationOutput, error) { 618 req, out := c.StartConversationRequest(input) 619 req.SetContext(ctx) 620 req.ApplyOptions(opts...) 621 return out, req.Send() 622} 623 624var _ awserr.Error 625 626// StartConversationEventStream provides the event stream handling for the StartConversation. 627// 628// For testing and mocking the event stream this type should be initialized via 629// the NewStartConversationEventStream constructor function. Using the functional options 630// to pass in nested mock behavior. 631type StartConversationEventStream struct { 632 633 // Writer is the EventStream writer for the StartConversationRequestEventStream 634 // events. This value is automatically set by the SDK when the API call is made 635 // Use this member when unit testing your code with the SDK to mock out the 636 // EventStream Writer. 637 // 638 // Must not be nil. 639 Writer StartConversationRequestEventStreamWriter 640 641 inputWriter io.WriteCloser 642 643 // Reader is the EventStream reader for the StartConversationResponseEventStream 644 // events. This value is automatically set by the SDK when the API call is made 645 // Use this member when unit testing your code with the SDK to mock out the 646 // EventStream Reader. 647 // 648 // Must not be nil. 649 Reader StartConversationResponseEventStreamReader 650 651 outputReader io.ReadCloser 652 653 done chan struct{} 654 closeOnce sync.Once 655 err *eventstreamapi.OnceError 656} 657 658// NewStartConversationEventStream initializes an StartConversationEventStream. 659// This function should only be used for testing and mocking the StartConversationEventStream 660// stream within your application. 661// 662// The Writer member must be set before writing events to the stream. 663// 664// The Reader member must be set before reading events from the stream. 665// 666// es := NewStartConversationEventStream(func(o *StartConversationEventStream{ 667// es.Writer = myMockStreamWriter 668// es.Reader = myMockStreamReader 669// }) 670func NewStartConversationEventStream(opts ...func(*StartConversationEventStream)) *StartConversationEventStream { 671 es := &StartConversationEventStream{ 672 done: make(chan struct{}), 673 err: eventstreamapi.NewOnceError(), 674 } 675 676 for _, fn := range opts { 677 fn(es) 678 } 679 680 return es 681} 682 683func (es *StartConversationEventStream) runOnStreamPartClose(r *request.Request) { 684 if es.done == nil { 685 return 686 } 687 go es.waitStreamPartClose() 688 689} 690 691func (es *StartConversationEventStream) waitStreamPartClose() { 692 var inputErrCh <-chan struct{} 693 if v, ok := es.Writer.(interface{ ErrorSet() <-chan struct{} }); ok { 694 inputErrCh = v.ErrorSet() 695 } 696 var outputErrCh <-chan struct{} 697 if v, ok := es.Reader.(interface{ ErrorSet() <-chan struct{} }); ok { 698 outputErrCh = v.ErrorSet() 699 } 700 var outputClosedCh <-chan struct{} 701 if v, ok := es.Reader.(interface{ Closed() <-chan struct{} }); ok { 702 outputClosedCh = v.Closed() 703 } 704 705 select { 706 case <-es.done: 707 case <-inputErrCh: 708 es.err.SetError(es.Writer.Err()) 709 es.Close() 710 case <-outputErrCh: 711 es.err.SetError(es.Reader.Err()) 712 es.Close() 713 case <-outputClosedCh: 714 if err := es.Reader.Err(); err != nil { 715 es.err.SetError(es.Reader.Err()) 716 } 717 es.Close() 718 } 719} 720 721func (es *StartConversationEventStream) setupInputPipe(r *request.Request) { 722 inputReader, inputWriter := io.Pipe() 723 r.SetStreamingBody(inputReader) 724 es.inputWriter = inputWriter 725} 726 727// Closes the input-pipe writer 728func (es *StartConversationEventStream) closeInputPipe() error { 729 if es.inputWriter != nil { 730 return es.inputWriter.Close() 731 } 732 return nil 733} 734 735// Send writes the event to the stream blocking until the event is written. 736// Returns an error if the event was not written. 737// 738// These events are: 739// 740// * AudioInputEvent 741// * ConfigurationEvent 742// * DTMFInputEvent 743// * DisconnectionEvent 744// * PlaybackCompletionEvent 745// * TextInputEvent 746func (es *StartConversationEventStream) Send(ctx aws.Context, event StartConversationRequestEventStreamEvent) error { 747 return es.Writer.Send(ctx, event) 748} 749 750func (es *StartConversationEventStream) runInputStream(r *request.Request) { 751 var opts []func(*eventstream.Encoder) 752 if r.Config.Logger != nil && r.Config.LogLevel.Matches(aws.LogDebugWithEventStreamBody) { 753 opts = append(opts, eventstream.EncodeWithLogger(r.Config.Logger)) 754 } 755 var encoder eventstreamapi.Encoder = eventstream.NewEncoder(es.inputWriter, opts...) 756 757 var closer aws.MultiCloser 758 sigSeed, err := v4.GetSignedRequestSignature(r.HTTPRequest) 759 if err != nil { 760 r.Error = awserr.New(request.ErrCodeSerialization, 761 "unable to get initial request's signature", err) 762 return 763 } 764 signer := eventstreamapi.NewSignEncoder( 765 v4.NewStreamSigner(r.ClientInfo.SigningRegion, r.ClientInfo.SigningName, 766 sigSeed, r.Config.Credentials), 767 encoder, 768 ) 769 encoder = signer 770 closer = append(closer, signer) 771 closer = append(closer, es.inputWriter) 772 773 eventWriter := eventstreamapi.NewEventWriter(encoder, 774 protocol.HandlerPayloadMarshal{ 775 Marshalers: r.Handlers.BuildStream, 776 }, 777 eventTypeForStartConversationRequestEventStreamEvent, 778 ) 779 780 es.Writer = &writeStartConversationRequestEventStream{ 781 StreamWriter: eventstreamapi.NewStreamWriter(eventWriter, closer), 782 } 783} 784 785// Events returns a channel to read events from. 786// 787// These events are: 788// 789// * AudioResponseEvent 790// * HeartbeatEvent 791// * IntentResultEvent 792// * PlaybackInterruptionEvent 793// * TextResponseEvent 794// * TranscriptEvent 795// * StartConversationResponseEventStreamUnknownEvent 796func (es *StartConversationEventStream) Events() <-chan StartConversationResponseEventStreamEvent { 797 return es.Reader.Events() 798} 799 800func (es *StartConversationEventStream) runOutputStream(r *request.Request) { 801 var opts []func(*eventstream.Decoder) 802 if r.Config.Logger != nil && r.Config.LogLevel.Matches(aws.LogDebugWithEventStreamBody) { 803 opts = append(opts, eventstream.DecodeWithLogger(r.Config.Logger)) 804 } 805 806 unmarshalerForEvent := unmarshalerForStartConversationResponseEventStreamEvent{ 807 metadata: protocol.ResponseMetadata{ 808 StatusCode: r.HTTPResponse.StatusCode, 809 RequestID: r.RequestID, 810 }, 811 }.UnmarshalerForEventName 812 813 decoder := eventstream.NewDecoder(r.HTTPResponse.Body, opts...) 814 eventReader := eventstreamapi.NewEventReader(decoder, 815 protocol.HandlerPayloadUnmarshal{ 816 Unmarshalers: r.Handlers.UnmarshalStream, 817 }, 818 unmarshalerForEvent, 819 ) 820 821 es.outputReader = r.HTTPResponse.Body 822 es.Reader = newReadStartConversationResponseEventStream(eventReader) 823} 824 825// Close closes the stream. This will also cause the stream to be closed. 826// Close must be called when done using the stream API. Not calling Close 827// may result in resource leaks. 828// 829// Will close the underlying EventStream writer, and no more events can be 830// sent. 831// 832// You can use the closing of the Reader's Events channel to terminate your 833// application's read from the API's stream. 834// 835func (es *StartConversationEventStream) Close() (err error) { 836 es.closeOnce.Do(es.safeClose) 837 return es.Err() 838} 839 840func (es *StartConversationEventStream) safeClose() { 841 if es.done != nil { 842 close(es.done) 843 } 844 845 t := time.NewTicker(time.Second) 846 defer t.Stop() 847 writeCloseDone := make(chan error) 848 go func() { 849 if err := es.Writer.Close(); err != nil { 850 es.err.SetError(err) 851 } 852 close(writeCloseDone) 853 }() 854 select { 855 case <-t.C: 856 case <-writeCloseDone: 857 } 858 if err := es.closeInputPipe(); err != nil { 859 es.err.SetError(err) 860 } 861 862 es.Reader.Close() 863 if es.outputReader != nil { 864 es.outputReader.Close() 865 } 866} 867 868// Err returns any error that occurred while reading or writing EventStream 869// Events from the service API's response. Returns nil if there were no errors. 870func (es *StartConversationEventStream) Err() error { 871 if err := es.err.Err(); err != nil { 872 return err 873 } 874 if err := es.Writer.Err(); err != nil { 875 return err 876 } 877 if err := es.Reader.Err(); err != nil { 878 return err 879 } 880 881 return nil 882} 883 884type AccessDeniedException struct { 885 _ struct{} `type:"structure"` 886 RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` 887 888 Message_ *string `locationName:"message" type:"string"` 889} 890 891// String returns the string representation 892func (s AccessDeniedException) String() string { 893 return awsutil.Prettify(s) 894} 895 896// GoString returns the string representation 897func (s AccessDeniedException) GoString() string { 898 return s.String() 899} 900 901// The AccessDeniedException is and event in the StartConversationResponseEventStream group of events. 902func (s *AccessDeniedException) eventStartConversationResponseEventStream() {} 903 904// UnmarshalEvent unmarshals the EventStream Message into the AccessDeniedException value. 905// This method is only used internally within the SDK's EventStream handling. 906func (s *AccessDeniedException) UnmarshalEvent( 907 payloadUnmarshaler protocol.PayloadUnmarshaler, 908 msg eventstream.Message, 909) error { 910 if err := payloadUnmarshaler.UnmarshalPayload( 911 bytes.NewReader(msg.Payload), s, 912 ); err != nil { 913 return err 914 } 915 return nil 916} 917 918// MarshalEvent marshals the type into an stream event value. This method 919// should only used internally within the SDK's EventStream handling. 920func (s *AccessDeniedException) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { 921 msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.ExceptionMessageType)) 922 var buf bytes.Buffer 923 if err = pm.MarshalPayload(&buf, s); err != nil { 924 return eventstream.Message{}, err 925 } 926 msg.Payload = buf.Bytes() 927 return msg, err 928} 929 930func newErrorAccessDeniedException(v protocol.ResponseMetadata) error { 931 return &AccessDeniedException{ 932 RespMetadata: v, 933 } 934} 935 936// Code returns the exception type name. 937func (s *AccessDeniedException) Code() string { 938 return "AccessDeniedException" 939} 940 941// Message returns the exception's message. 942func (s *AccessDeniedException) Message() string { 943 if s.Message_ != nil { 944 return *s.Message_ 945 } 946 return "" 947} 948 949// OrigErr always returns nil, satisfies awserr.Error interface. 950func (s *AccessDeniedException) OrigErr() error { 951 return nil 952} 953 954func (s *AccessDeniedException) Error() string { 955 return fmt.Sprintf("%s: %s", s.Code(), s.Message()) 956} 957 958// Status code returns the HTTP status code for the request's response error. 959func (s *AccessDeniedException) StatusCode() int { 960 return s.RespMetadata.StatusCode 961} 962 963// RequestID returns the service's response RequestID for request. 964func (s *AccessDeniedException) RequestID() string { 965 return s.RespMetadata.RequestID 966} 967 968// Contains information about the contexts that a user is using in a session. 969// You can configure Amazon Lex to set a context when an intent is fulfilled, 970// or you can set a context using the , , or operations. 971// 972// Use a context to indicate to Amazon Lex intents that should be used as follow-up 973// intents. For example, if the active context is order-fulfilled, only intents 974// that have order-fulfilled configured as a trigger are considered for follow 975// up. 976type ActiveContext struct { 977 _ struct{} `type:"structure"` 978 979 // A lis tof contexts active for the request. A context can be activated when 980 // a previous intent is fulfilled, or by including the context in the request. 981 // 982 // If you don't specify a list of contexts, Amazon Lex will use the current 983 // list of contexts for the session. If you specify an empty list, all contexts 984 // for the session are cleared. 985 ContextAttributes map[string]*string `locationName:"contextAttributes" type:"map"` 986 987 // The name of the context. 988 // 989 // Name is a required field 990 Name *string `locationName:"name" min:"1" type:"string" required:"true"` 991 992 // Indicates the number of turns or seconds that the context is active. Once 993 // the time to live expires, the context is no longer returned in a response. 994 // 995 // TimeToLive is a required field 996 TimeToLive *ActiveContextTimeToLive `locationName:"timeToLive" type:"structure" required:"true"` 997} 998 999// String returns the string representation 1000func (s ActiveContext) String() string { 1001 return awsutil.Prettify(s) 1002} 1003 1004// GoString returns the string representation 1005func (s ActiveContext) GoString() string { 1006 return s.String() 1007} 1008 1009// Validate inspects the fields of the type to determine if they are valid. 1010func (s *ActiveContext) Validate() error { 1011 invalidParams := request.ErrInvalidParams{Context: "ActiveContext"} 1012 if s.Name == nil { 1013 invalidParams.Add(request.NewErrParamRequired("Name")) 1014 } 1015 if s.Name != nil && len(*s.Name) < 1 { 1016 invalidParams.Add(request.NewErrParamMinLen("Name", 1)) 1017 } 1018 if s.TimeToLive == nil { 1019 invalidParams.Add(request.NewErrParamRequired("TimeToLive")) 1020 } 1021 if s.TimeToLive != nil { 1022 if err := s.TimeToLive.Validate(); err != nil { 1023 invalidParams.AddNested("TimeToLive", err.(request.ErrInvalidParams)) 1024 } 1025 } 1026 1027 if invalidParams.Len() > 0 { 1028 return invalidParams 1029 } 1030 return nil 1031} 1032 1033// SetContextAttributes sets the ContextAttributes field's value. 1034func (s *ActiveContext) SetContextAttributes(v map[string]*string) *ActiveContext { 1035 s.ContextAttributes = v 1036 return s 1037} 1038 1039// SetName sets the Name field's value. 1040func (s *ActiveContext) SetName(v string) *ActiveContext { 1041 s.Name = &v 1042 return s 1043} 1044 1045// SetTimeToLive sets the TimeToLive field's value. 1046func (s *ActiveContext) SetTimeToLive(v *ActiveContextTimeToLive) *ActiveContext { 1047 s.TimeToLive = v 1048 return s 1049} 1050 1051// The time that a context is active. You can specify the time to live in seconds 1052// or in conversation turns. 1053type ActiveContextTimeToLive struct { 1054 _ struct{} `type:"structure"` 1055 1056 // The number of seconds that the context is active. You can specify between 1057 // 5 and 86400 seconds (24 hours). 1058 // 1059 // TimeToLiveInSeconds is a required field 1060 TimeToLiveInSeconds *int64 `locationName:"timeToLiveInSeconds" min:"5" type:"integer" required:"true"` 1061 1062 // The number of turns that the context is active. You can specify up to 20 1063 // turns. Each request and response from the bot is a turn. 1064 // 1065 // TurnsToLive is a required field 1066 TurnsToLive *int64 `locationName:"turnsToLive" min:"1" type:"integer" required:"true"` 1067} 1068 1069// String returns the string representation 1070func (s ActiveContextTimeToLive) String() string { 1071 return awsutil.Prettify(s) 1072} 1073 1074// GoString returns the string representation 1075func (s ActiveContextTimeToLive) GoString() string { 1076 return s.String() 1077} 1078 1079// Validate inspects the fields of the type to determine if they are valid. 1080func (s *ActiveContextTimeToLive) Validate() error { 1081 invalidParams := request.ErrInvalidParams{Context: "ActiveContextTimeToLive"} 1082 if s.TimeToLiveInSeconds == nil { 1083 invalidParams.Add(request.NewErrParamRequired("TimeToLiveInSeconds")) 1084 } 1085 if s.TimeToLiveInSeconds != nil && *s.TimeToLiveInSeconds < 5 { 1086 invalidParams.Add(request.NewErrParamMinValue("TimeToLiveInSeconds", 5)) 1087 } 1088 if s.TurnsToLive == nil { 1089 invalidParams.Add(request.NewErrParamRequired("TurnsToLive")) 1090 } 1091 if s.TurnsToLive != nil && *s.TurnsToLive < 1 { 1092 invalidParams.Add(request.NewErrParamMinValue("TurnsToLive", 1)) 1093 } 1094 1095 if invalidParams.Len() > 0 { 1096 return invalidParams 1097 } 1098 return nil 1099} 1100 1101// SetTimeToLiveInSeconds sets the TimeToLiveInSeconds field's value. 1102func (s *ActiveContextTimeToLive) SetTimeToLiveInSeconds(v int64) *ActiveContextTimeToLive { 1103 s.TimeToLiveInSeconds = &v 1104 return s 1105} 1106 1107// SetTurnsToLive sets the TurnsToLive field's value. 1108func (s *ActiveContextTimeToLive) SetTurnsToLive(v int64) *ActiveContextTimeToLive { 1109 s.TurnsToLive = &v 1110 return s 1111} 1112 1113// Represents a chunk of audio sent from the client application to Amazon Lex. 1114// The audio is all or part of an utterance from the user. 1115// 1116// Amazon Lex accumulates audio chunks until it recognizes a natural pause in 1117// speech before processing the input. 1118type AudioInputEvent struct { 1119 _ struct{} `type:"structure"` 1120 1121 // An encoded stream of audio. 1122 // 1123 // AudioChunk is automatically base64 encoded/decoded by the SDK. 1124 AudioChunk []byte `locationName:"audioChunk" type:"blob"` 1125 1126 // A timestamp set by the client of the date and time that the event was sent 1127 // to Amazon Lex. 1128 ClientTimestampMillis *int64 `locationName:"clientTimestampMillis" type:"long"` 1129 1130 // The encoding used for the audio chunk. You must use 8 KHz PCM 16-bit mono-channel 1131 // little-endian format. The value of the field should be: 1132 // 1133 // audio/lpcm; sample-rate=8000; sample-size-bits=16; channel-count=1; is-big-endian=false 1134 // 1135 // ContentType is a required field 1136 ContentType *string `locationName:"contentType" min:"1" type:"string" required:"true"` 1137 1138 // A unique identifier that your application assigns to the event. You can use 1139 // this to identify events in logs. 1140 EventId *string `locationName:"eventId" min:"2" type:"string"` 1141} 1142 1143// String returns the string representation 1144func (s AudioInputEvent) String() string { 1145 return awsutil.Prettify(s) 1146} 1147 1148// GoString returns the string representation 1149func (s AudioInputEvent) GoString() string { 1150 return s.String() 1151} 1152 1153// SetAudioChunk sets the AudioChunk field's value. 1154func (s *AudioInputEvent) SetAudioChunk(v []byte) *AudioInputEvent { 1155 s.AudioChunk = v 1156 return s 1157} 1158 1159// SetClientTimestampMillis sets the ClientTimestampMillis field's value. 1160func (s *AudioInputEvent) SetClientTimestampMillis(v int64) *AudioInputEvent { 1161 s.ClientTimestampMillis = &v 1162 return s 1163} 1164 1165// SetContentType sets the ContentType field's value. 1166func (s *AudioInputEvent) SetContentType(v string) *AudioInputEvent { 1167 s.ContentType = &v 1168 return s 1169} 1170 1171// SetEventId sets the EventId field's value. 1172func (s *AudioInputEvent) SetEventId(v string) *AudioInputEvent { 1173 s.EventId = &v 1174 return s 1175} 1176 1177// The AudioInputEvent is and event in the StartConversationRequestEventStream group of events. 1178func (s *AudioInputEvent) eventStartConversationRequestEventStream() {} 1179 1180// UnmarshalEvent unmarshals the EventStream Message into the AudioInputEvent value. 1181// This method is only used internally within the SDK's EventStream handling. 1182func (s *AudioInputEvent) UnmarshalEvent( 1183 payloadUnmarshaler protocol.PayloadUnmarshaler, 1184 msg eventstream.Message, 1185) error { 1186 if err := payloadUnmarshaler.UnmarshalPayload( 1187 bytes.NewReader(msg.Payload), s, 1188 ); err != nil { 1189 return err 1190 } 1191 return nil 1192} 1193 1194// MarshalEvent marshals the type into an stream event value. This method 1195// should only used internally within the SDK's EventStream handling. 1196func (s *AudioInputEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { 1197 msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType)) 1198 var buf bytes.Buffer 1199 if err = pm.MarshalPayload(&buf, s); err != nil { 1200 return eventstream.Message{}, err 1201 } 1202 msg.Payload = buf.Bytes() 1203 return msg, err 1204} 1205 1206// An event sent from Amazon Lex to your client application containing audio 1207// to play to the user. 1208type AudioResponseEvent struct { 1209 _ struct{} `type:"structure"` 1210 1211 // A chunk of the audio to play. 1212 // 1213 // AudioChunk is automatically base64 encoded/decoded by the SDK. 1214 AudioChunk []byte `locationName:"audioChunk" type:"blob"` 1215 1216 // The encoding of the audio chunk. This is the same as the encoding configure 1217 // in the contentType field of the ConfigurationEvent. 1218 ContentType *string `locationName:"contentType" min:"1" type:"string"` 1219 1220 // A unique identifier of the event sent by Amazon Lex. The identifier is in 1221 // the form RESPONSE-N, where N is a number starting with one and incremented 1222 // for each event sent by Amazon Lex in the current session. 1223 EventId *string `locationName:"eventId" min:"2" type:"string"` 1224} 1225 1226// String returns the string representation 1227func (s AudioResponseEvent) String() string { 1228 return awsutil.Prettify(s) 1229} 1230 1231// GoString returns the string representation 1232func (s AudioResponseEvent) GoString() string { 1233 return s.String() 1234} 1235 1236// SetAudioChunk sets the AudioChunk field's value. 1237func (s *AudioResponseEvent) SetAudioChunk(v []byte) *AudioResponseEvent { 1238 s.AudioChunk = v 1239 return s 1240} 1241 1242// SetContentType sets the ContentType field's value. 1243func (s *AudioResponseEvent) SetContentType(v string) *AudioResponseEvent { 1244 s.ContentType = &v 1245 return s 1246} 1247 1248// SetEventId sets the EventId field's value. 1249func (s *AudioResponseEvent) SetEventId(v string) *AudioResponseEvent { 1250 s.EventId = &v 1251 return s 1252} 1253 1254// The AudioResponseEvent is and event in the StartConversationResponseEventStream group of events. 1255func (s *AudioResponseEvent) eventStartConversationResponseEventStream() {} 1256 1257// UnmarshalEvent unmarshals the EventStream Message into the AudioResponseEvent value. 1258// This method is only used internally within the SDK's EventStream handling. 1259func (s *AudioResponseEvent) UnmarshalEvent( 1260 payloadUnmarshaler protocol.PayloadUnmarshaler, 1261 msg eventstream.Message, 1262) error { 1263 if err := payloadUnmarshaler.UnmarshalPayload( 1264 bytes.NewReader(msg.Payload), s, 1265 ); err != nil { 1266 return err 1267 } 1268 return nil 1269} 1270 1271// MarshalEvent marshals the type into an stream event value. This method 1272// should only used internally within the SDK's EventStream handling. 1273func (s *AudioResponseEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { 1274 msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType)) 1275 var buf bytes.Buffer 1276 if err = pm.MarshalPayload(&buf, s); err != nil { 1277 return eventstream.Message{}, err 1278 } 1279 msg.Payload = buf.Bytes() 1280 return msg, err 1281} 1282 1283type BadGatewayException struct { 1284 _ struct{} `type:"structure"` 1285 RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` 1286 1287 Message_ *string `locationName:"message" type:"string"` 1288} 1289 1290// String returns the string representation 1291func (s BadGatewayException) String() string { 1292 return awsutil.Prettify(s) 1293} 1294 1295// GoString returns the string representation 1296func (s BadGatewayException) GoString() string { 1297 return s.String() 1298} 1299 1300// The BadGatewayException is and event in the StartConversationResponseEventStream group of events. 1301func (s *BadGatewayException) eventStartConversationResponseEventStream() {} 1302 1303// UnmarshalEvent unmarshals the EventStream Message into the BadGatewayException value. 1304// This method is only used internally within the SDK's EventStream handling. 1305func (s *BadGatewayException) UnmarshalEvent( 1306 payloadUnmarshaler protocol.PayloadUnmarshaler, 1307 msg eventstream.Message, 1308) error { 1309 if err := payloadUnmarshaler.UnmarshalPayload( 1310 bytes.NewReader(msg.Payload), s, 1311 ); err != nil { 1312 return err 1313 } 1314 return nil 1315} 1316 1317// MarshalEvent marshals the type into an stream event value. This method 1318// should only used internally within the SDK's EventStream handling. 1319func (s *BadGatewayException) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { 1320 msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.ExceptionMessageType)) 1321 var buf bytes.Buffer 1322 if err = pm.MarshalPayload(&buf, s); err != nil { 1323 return eventstream.Message{}, err 1324 } 1325 msg.Payload = buf.Bytes() 1326 return msg, err 1327} 1328 1329func newErrorBadGatewayException(v protocol.ResponseMetadata) error { 1330 return &BadGatewayException{ 1331 RespMetadata: v, 1332 } 1333} 1334 1335// Code returns the exception type name. 1336func (s *BadGatewayException) Code() string { 1337 return "BadGatewayException" 1338} 1339 1340// Message returns the exception's message. 1341func (s *BadGatewayException) Message() string { 1342 if s.Message_ != nil { 1343 return *s.Message_ 1344 } 1345 return "" 1346} 1347 1348// OrigErr always returns nil, satisfies awserr.Error interface. 1349func (s *BadGatewayException) OrigErr() error { 1350 return nil 1351} 1352 1353func (s *BadGatewayException) Error() string { 1354 return fmt.Sprintf("%s: %s", s.Code(), s.Message()) 1355} 1356 1357// Status code returns the HTTP status code for the request's response error. 1358func (s *BadGatewayException) StatusCode() int { 1359 return s.RespMetadata.StatusCode 1360} 1361 1362// RequestID returns the service's response RequestID for request. 1363func (s *BadGatewayException) RequestID() string { 1364 return s.RespMetadata.RequestID 1365} 1366 1367// A button that appears on a response card show to the user. 1368type Button struct { 1369 _ struct{} `type:"structure"` 1370 1371 // The text that is displayed on the button. 1372 // 1373 // Text is a required field 1374 Text *string `locationName:"text" min:"1" type:"string" required:"true"` 1375 1376 // The value returned to Amazon Lex when a user chooses the button. 1377 // 1378 // Value is a required field 1379 Value *string `locationName:"value" min:"1" type:"string" required:"true"` 1380} 1381 1382// String returns the string representation 1383func (s Button) String() string { 1384 return awsutil.Prettify(s) 1385} 1386 1387// GoString returns the string representation 1388func (s Button) GoString() string { 1389 return s.String() 1390} 1391 1392// Validate inspects the fields of the type to determine if they are valid. 1393func (s *Button) Validate() error { 1394 invalidParams := request.ErrInvalidParams{Context: "Button"} 1395 if s.Text == nil { 1396 invalidParams.Add(request.NewErrParamRequired("Text")) 1397 } 1398 if s.Text != nil && len(*s.Text) < 1 { 1399 invalidParams.Add(request.NewErrParamMinLen("Text", 1)) 1400 } 1401 if s.Value == nil { 1402 invalidParams.Add(request.NewErrParamRequired("Value")) 1403 } 1404 if s.Value != nil && len(*s.Value) < 1 { 1405 invalidParams.Add(request.NewErrParamMinLen("Value", 1)) 1406 } 1407 1408 if invalidParams.Len() > 0 { 1409 return invalidParams 1410 } 1411 return nil 1412} 1413 1414// SetText sets the Text field's value. 1415func (s *Button) SetText(v string) *Button { 1416 s.Text = &v 1417 return s 1418} 1419 1420// SetValue sets the Value field's value. 1421func (s *Button) SetValue(v string) *Button { 1422 s.Value = &v 1423 return s 1424} 1425 1426// Provides a score that indicates the confidence that Amazon Lex has that an 1427// intent is the one that satisfies the user's intent. 1428type ConfidenceScore struct { 1429 _ struct{} `type:"structure"` 1430 1431 // A score that indicates how confident Amazon Lex is that an intent satisfies 1432 // the user's intent. Ranges between 0.00 and 1.00. Higher scores indicate higher 1433 // confidence. 1434 Score *float64 `locationName:"score" type:"double"` 1435} 1436 1437// String returns the string representation 1438func (s ConfidenceScore) String() string { 1439 return awsutil.Prettify(s) 1440} 1441 1442// GoString returns the string representation 1443func (s ConfidenceScore) GoString() string { 1444 return s.String() 1445} 1446 1447// SetScore sets the Score field's value. 1448func (s *ConfidenceScore) SetScore(v float64) *ConfidenceScore { 1449 s.Score = &v 1450 return s 1451} 1452 1453// The initial event sent from the application to Amazon Lex to configure the 1454// conversation, including session and request attributes and the response content 1455// type. 1456type ConfigurationEvent struct { 1457 _ struct{} `type:"structure"` 1458 1459 // A timestamp set by the client of the date and time that the event was sent 1460 // to Amazon Lex. 1461 ClientTimestampMillis *int64 `locationName:"clientTimestampMillis" type:"long"` 1462 1463 // Determines whether Amazon Lex should send audio responses to the client application. 1464 // When this parameter if false, the client application needs to create responses 1465 // for the user. 1466 DisablePlayback *bool `locationName:"disablePlayback" type:"boolean"` 1467 1468 // A unique identifier that your application assigns to the event. You can use 1469 // this to identify events in logs. 1470 EventId *string `locationName:"eventId" min:"2" type:"string"` 1471 1472 // Request-specific information passed between the client application and Amazon 1473 // Lex. 1474 // 1475 // The namespace x-amz-lex: is reserved for special attributes. Don't create 1476 // any request attributes for prefix x-amz-lex:. 1477 RequestAttributes map[string]*string `locationName:"requestAttributes" type:"map"` 1478 1479 // The message that Amazon Lex returns in the response can be either text or 1480 // speech based on the responseContentType value. 1481 // 1482 // * If the value is text/plain;charset=utf-8, Amazon Lex returns text in 1483 // the response. 1484 // 1485 // * If the value begins with audio/, Amazon Lex returns speech in the response. 1486 // Amazon Lex uses Amazon Polly to generate the speech using the configuration 1487 // that you specified in the requestContentType parameter. For example, if 1488 // you specify audio/mpeg as the value, Amazon Lex returns speech in the 1489 // MPEG format. 1490 // 1491 // * If the value is audio/pcm, the speech returned is audio/pcm in 16-bit, 1492 // little-endian format. 1493 // 1494 // * The following are the accepted values: audio/mpeg audio/ogg audio/pcm 1495 // audio/* (defaults to mpeg) text/plain; charset=utf-8 1496 // 1497 // ResponseContentType is a required field 1498 ResponseContentType *string `locationName:"responseContentType" min:"1" type:"string" required:"true"` 1499 1500 // The state of the user's session with Amazon Lex. 1501 SessionState *SessionState `locationName:"sessionState" type:"structure"` 1502 1503 // A list of messages to send to the user. 1504 WelcomeMessages []*Message `locationName:"welcomeMessages" type:"list"` 1505} 1506 1507// String returns the string representation 1508func (s ConfigurationEvent) String() string { 1509 return awsutil.Prettify(s) 1510} 1511 1512// GoString returns the string representation 1513func (s ConfigurationEvent) GoString() string { 1514 return s.String() 1515} 1516 1517// SetClientTimestampMillis sets the ClientTimestampMillis field's value. 1518func (s *ConfigurationEvent) SetClientTimestampMillis(v int64) *ConfigurationEvent { 1519 s.ClientTimestampMillis = &v 1520 return s 1521} 1522 1523// SetDisablePlayback sets the DisablePlayback field's value. 1524func (s *ConfigurationEvent) SetDisablePlayback(v bool) *ConfigurationEvent { 1525 s.DisablePlayback = &v 1526 return s 1527} 1528 1529// SetEventId sets the EventId field's value. 1530func (s *ConfigurationEvent) SetEventId(v string) *ConfigurationEvent { 1531 s.EventId = &v 1532 return s 1533} 1534 1535// SetRequestAttributes sets the RequestAttributes field's value. 1536func (s *ConfigurationEvent) SetRequestAttributes(v map[string]*string) *ConfigurationEvent { 1537 s.RequestAttributes = v 1538 return s 1539} 1540 1541// SetResponseContentType sets the ResponseContentType field's value. 1542func (s *ConfigurationEvent) SetResponseContentType(v string) *ConfigurationEvent { 1543 s.ResponseContentType = &v 1544 return s 1545} 1546 1547// SetSessionState sets the SessionState field's value. 1548func (s *ConfigurationEvent) SetSessionState(v *SessionState) *ConfigurationEvent { 1549 s.SessionState = v 1550 return s 1551} 1552 1553// SetWelcomeMessages sets the WelcomeMessages field's value. 1554func (s *ConfigurationEvent) SetWelcomeMessages(v []*Message) *ConfigurationEvent { 1555 s.WelcomeMessages = v 1556 return s 1557} 1558 1559// The ConfigurationEvent is and event in the StartConversationRequestEventStream group of events. 1560func (s *ConfigurationEvent) eventStartConversationRequestEventStream() {} 1561 1562// UnmarshalEvent unmarshals the EventStream Message into the ConfigurationEvent value. 1563// This method is only used internally within the SDK's EventStream handling. 1564func (s *ConfigurationEvent) UnmarshalEvent( 1565 payloadUnmarshaler protocol.PayloadUnmarshaler, 1566 msg eventstream.Message, 1567) error { 1568 if err := payloadUnmarshaler.UnmarshalPayload( 1569 bytes.NewReader(msg.Payload), s, 1570 ); err != nil { 1571 return err 1572 } 1573 return nil 1574} 1575 1576// MarshalEvent marshals the type into an stream event value. This method 1577// should only used internally within the SDK's EventStream handling. 1578func (s *ConfigurationEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { 1579 msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType)) 1580 var buf bytes.Buffer 1581 if err = pm.MarshalPayload(&buf, s); err != nil { 1582 return eventstream.Message{}, err 1583 } 1584 msg.Payload = buf.Bytes() 1585 return msg, err 1586} 1587 1588type ConflictException struct { 1589 _ struct{} `type:"structure"` 1590 RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` 1591 1592 Message_ *string `locationName:"message" type:"string"` 1593} 1594 1595// String returns the string representation 1596func (s ConflictException) String() string { 1597 return awsutil.Prettify(s) 1598} 1599 1600// GoString returns the string representation 1601func (s ConflictException) GoString() string { 1602 return s.String() 1603} 1604 1605// The ConflictException is and event in the StartConversationResponseEventStream group of events. 1606func (s *ConflictException) eventStartConversationResponseEventStream() {} 1607 1608// UnmarshalEvent unmarshals the EventStream Message into the ConflictException value. 1609// This method is only used internally within the SDK's EventStream handling. 1610func (s *ConflictException) UnmarshalEvent( 1611 payloadUnmarshaler protocol.PayloadUnmarshaler, 1612 msg eventstream.Message, 1613) error { 1614 if err := payloadUnmarshaler.UnmarshalPayload( 1615 bytes.NewReader(msg.Payload), s, 1616 ); err != nil { 1617 return err 1618 } 1619 return nil 1620} 1621 1622// MarshalEvent marshals the type into an stream event value. This method 1623// should only used internally within the SDK's EventStream handling. 1624func (s *ConflictException) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { 1625 msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.ExceptionMessageType)) 1626 var buf bytes.Buffer 1627 if err = pm.MarshalPayload(&buf, s); err != nil { 1628 return eventstream.Message{}, err 1629 } 1630 msg.Payload = buf.Bytes() 1631 return msg, err 1632} 1633 1634func newErrorConflictException(v protocol.ResponseMetadata) error { 1635 return &ConflictException{ 1636 RespMetadata: v, 1637 } 1638} 1639 1640// Code returns the exception type name. 1641func (s *ConflictException) Code() string { 1642 return "ConflictException" 1643} 1644 1645// Message returns the exception's message. 1646func (s *ConflictException) Message() string { 1647 if s.Message_ != nil { 1648 return *s.Message_ 1649 } 1650 return "" 1651} 1652 1653// OrigErr always returns nil, satisfies awserr.Error interface. 1654func (s *ConflictException) OrigErr() error { 1655 return nil 1656} 1657 1658func (s *ConflictException) Error() string { 1659 return fmt.Sprintf("%s: %s", s.Code(), s.Message()) 1660} 1661 1662// Status code returns the HTTP status code for the request's response error. 1663func (s *ConflictException) StatusCode() int { 1664 return s.RespMetadata.StatusCode 1665} 1666 1667// RequestID returns the service's response RequestID for request. 1668func (s *ConflictException) RequestID() string { 1669 return s.RespMetadata.RequestID 1670} 1671 1672// A DTMF character sent from the client application. DTMF characters are typically 1673// sent from a phone keypad to represent numbers. For example, you can have 1674// Amazon Lex process a credit card number input from a phone. 1675type DTMFInputEvent struct { 1676 _ struct{} `type:"structure"` 1677 1678 // A timestamp set by the client of the date and time that the event was sent 1679 // to Amazon Lex. 1680 ClientTimestampMillis *int64 `locationName:"clientTimestampMillis" type:"long"` 1681 1682 // A unique identifier that your application assigns to the event. You can use 1683 // this to identify events in logs. 1684 EventId *string `locationName:"eventId" min:"2" type:"string"` 1685 1686 // The DTMF character that the user pressed. The allowed characters are A - 1687 // D, 0 - 9, # and *. 1688 // 1689 // InputCharacter is a required field 1690 InputCharacter *string `locationName:"inputCharacter" min:"1" type:"string" required:"true" sensitive:"true"` 1691} 1692 1693// String returns the string representation 1694func (s DTMFInputEvent) String() string { 1695 return awsutil.Prettify(s) 1696} 1697 1698// GoString returns the string representation 1699func (s DTMFInputEvent) GoString() string { 1700 return s.String() 1701} 1702 1703// SetClientTimestampMillis sets the ClientTimestampMillis field's value. 1704func (s *DTMFInputEvent) SetClientTimestampMillis(v int64) *DTMFInputEvent { 1705 s.ClientTimestampMillis = &v 1706 return s 1707} 1708 1709// SetEventId sets the EventId field's value. 1710func (s *DTMFInputEvent) SetEventId(v string) *DTMFInputEvent { 1711 s.EventId = &v 1712 return s 1713} 1714 1715// SetInputCharacter sets the InputCharacter field's value. 1716func (s *DTMFInputEvent) SetInputCharacter(v string) *DTMFInputEvent { 1717 s.InputCharacter = &v 1718 return s 1719} 1720 1721// The DTMFInputEvent is and event in the StartConversationRequestEventStream group of events. 1722func (s *DTMFInputEvent) eventStartConversationRequestEventStream() {} 1723 1724// UnmarshalEvent unmarshals the EventStream Message into the DTMFInputEvent value. 1725// This method is only used internally within the SDK's EventStream handling. 1726func (s *DTMFInputEvent) UnmarshalEvent( 1727 payloadUnmarshaler protocol.PayloadUnmarshaler, 1728 msg eventstream.Message, 1729) error { 1730 if err := payloadUnmarshaler.UnmarshalPayload( 1731 bytes.NewReader(msg.Payload), s, 1732 ); err != nil { 1733 return err 1734 } 1735 return nil 1736} 1737 1738// MarshalEvent marshals the type into an stream event value. This method 1739// should only used internally within the SDK's EventStream handling. 1740func (s *DTMFInputEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { 1741 msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType)) 1742 var buf bytes.Buffer 1743 if err = pm.MarshalPayload(&buf, s); err != nil { 1744 return eventstream.Message{}, err 1745 } 1746 msg.Payload = buf.Bytes() 1747 return msg, err 1748} 1749 1750type DeleteSessionInput struct { 1751 _ struct{} `type:"structure"` 1752 1753 // The alias identifier in use for the bot that contains the session data. 1754 // 1755 // BotAliasId is a required field 1756 BotAliasId *string `location:"uri" locationName:"botAliasId" type:"string" required:"true"` 1757 1758 // The identifier of the bot that contains the session data. 1759 // 1760 // BotId is a required field 1761 BotId *string `location:"uri" locationName:"botId" min:"10" type:"string" required:"true"` 1762 1763 // The locale where the session is in use. 1764 // 1765 // LocaleId is a required field 1766 LocaleId *string `location:"uri" locationName:"localeId" min:"1" type:"string" required:"true"` 1767 1768 // The identifier of the session to delete. 1769 // 1770 // SessionId is a required field 1771 SessionId *string `location:"uri" locationName:"sessionId" min:"2" type:"string" required:"true"` 1772} 1773 1774// String returns the string representation 1775func (s DeleteSessionInput) String() string { 1776 return awsutil.Prettify(s) 1777} 1778 1779// GoString returns the string representation 1780func (s DeleteSessionInput) GoString() string { 1781 return s.String() 1782} 1783 1784// Validate inspects the fields of the type to determine if they are valid. 1785func (s *DeleteSessionInput) Validate() error { 1786 invalidParams := request.ErrInvalidParams{Context: "DeleteSessionInput"} 1787 if s.BotAliasId == nil { 1788 invalidParams.Add(request.NewErrParamRequired("BotAliasId")) 1789 } 1790 if s.BotAliasId != nil && len(*s.BotAliasId) < 1 { 1791 invalidParams.Add(request.NewErrParamMinLen("BotAliasId", 1)) 1792 } 1793 if s.BotId == nil { 1794 invalidParams.Add(request.NewErrParamRequired("BotId")) 1795 } 1796 if s.BotId != nil && len(*s.BotId) < 10 { 1797 invalidParams.Add(request.NewErrParamMinLen("BotId", 10)) 1798 } 1799 if s.LocaleId == nil { 1800 invalidParams.Add(request.NewErrParamRequired("LocaleId")) 1801 } 1802 if s.LocaleId != nil && len(*s.LocaleId) < 1 { 1803 invalidParams.Add(request.NewErrParamMinLen("LocaleId", 1)) 1804 } 1805 if s.SessionId == nil { 1806 invalidParams.Add(request.NewErrParamRequired("SessionId")) 1807 } 1808 if s.SessionId != nil && len(*s.SessionId) < 2 { 1809 invalidParams.Add(request.NewErrParamMinLen("SessionId", 2)) 1810 } 1811 1812 if invalidParams.Len() > 0 { 1813 return invalidParams 1814 } 1815 return nil 1816} 1817 1818// SetBotAliasId sets the BotAliasId field's value. 1819func (s *DeleteSessionInput) SetBotAliasId(v string) *DeleteSessionInput { 1820 s.BotAliasId = &v 1821 return s 1822} 1823 1824// SetBotId sets the BotId field's value. 1825func (s *DeleteSessionInput) SetBotId(v string) *DeleteSessionInput { 1826 s.BotId = &v 1827 return s 1828} 1829 1830// SetLocaleId sets the LocaleId field's value. 1831func (s *DeleteSessionInput) SetLocaleId(v string) *DeleteSessionInput { 1832 s.LocaleId = &v 1833 return s 1834} 1835 1836// SetSessionId sets the SessionId field's value. 1837func (s *DeleteSessionInput) SetSessionId(v string) *DeleteSessionInput { 1838 s.SessionId = &v 1839 return s 1840} 1841 1842type DeleteSessionOutput struct { 1843 _ struct{} `type:"structure"` 1844 1845 // The alias identifier in use for the bot that contained the session data. 1846 BotAliasId *string `locationName:"botAliasId" type:"string"` 1847 1848 // The identifier of the bot that contained the session data. 1849 BotId *string `locationName:"botId" min:"10" type:"string"` 1850 1851 // The locale where the session was used. 1852 LocaleId *string `locationName:"localeId" min:"1" type:"string"` 1853 1854 // The identifier of the deleted session. 1855 SessionId *string `locationName:"sessionId" min:"2" type:"string"` 1856} 1857 1858// String returns the string representation 1859func (s DeleteSessionOutput) String() string { 1860 return awsutil.Prettify(s) 1861} 1862 1863// GoString returns the string representation 1864func (s DeleteSessionOutput) GoString() string { 1865 return s.String() 1866} 1867 1868// SetBotAliasId sets the BotAliasId field's value. 1869func (s *DeleteSessionOutput) SetBotAliasId(v string) *DeleteSessionOutput { 1870 s.BotAliasId = &v 1871 return s 1872} 1873 1874// SetBotId sets the BotId field's value. 1875func (s *DeleteSessionOutput) SetBotId(v string) *DeleteSessionOutput { 1876 s.BotId = &v 1877 return s 1878} 1879 1880// SetLocaleId sets the LocaleId field's value. 1881func (s *DeleteSessionOutput) SetLocaleId(v string) *DeleteSessionOutput { 1882 s.LocaleId = &v 1883 return s 1884} 1885 1886// SetSessionId sets the SessionId field's value. 1887func (s *DeleteSessionOutput) SetSessionId(v string) *DeleteSessionOutput { 1888 s.SessionId = &v 1889 return s 1890} 1891 1892type DependencyFailedException struct { 1893 _ struct{} `type:"structure"` 1894 RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` 1895 1896 Message_ *string `locationName:"message" type:"string"` 1897} 1898 1899// String returns the string representation 1900func (s DependencyFailedException) String() string { 1901 return awsutil.Prettify(s) 1902} 1903 1904// GoString returns the string representation 1905func (s DependencyFailedException) GoString() string { 1906 return s.String() 1907} 1908 1909// The DependencyFailedException is and event in the StartConversationResponseEventStream group of events. 1910func (s *DependencyFailedException) eventStartConversationResponseEventStream() {} 1911 1912// UnmarshalEvent unmarshals the EventStream Message into the DependencyFailedException value. 1913// This method is only used internally within the SDK's EventStream handling. 1914func (s *DependencyFailedException) UnmarshalEvent( 1915 payloadUnmarshaler protocol.PayloadUnmarshaler, 1916 msg eventstream.Message, 1917) error { 1918 if err := payloadUnmarshaler.UnmarshalPayload( 1919 bytes.NewReader(msg.Payload), s, 1920 ); err != nil { 1921 return err 1922 } 1923 return nil 1924} 1925 1926// MarshalEvent marshals the type into an stream event value. This method 1927// should only used internally within the SDK's EventStream handling. 1928func (s *DependencyFailedException) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { 1929 msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.ExceptionMessageType)) 1930 var buf bytes.Buffer 1931 if err = pm.MarshalPayload(&buf, s); err != nil { 1932 return eventstream.Message{}, err 1933 } 1934 msg.Payload = buf.Bytes() 1935 return msg, err 1936} 1937 1938func newErrorDependencyFailedException(v protocol.ResponseMetadata) error { 1939 return &DependencyFailedException{ 1940 RespMetadata: v, 1941 } 1942} 1943 1944// Code returns the exception type name. 1945func (s *DependencyFailedException) Code() string { 1946 return "DependencyFailedException" 1947} 1948 1949// Message returns the exception's message. 1950func (s *DependencyFailedException) Message() string { 1951 if s.Message_ != nil { 1952 return *s.Message_ 1953 } 1954 return "" 1955} 1956 1957// OrigErr always returns nil, satisfies awserr.Error interface. 1958func (s *DependencyFailedException) OrigErr() error { 1959 return nil 1960} 1961 1962func (s *DependencyFailedException) Error() string { 1963 return fmt.Sprintf("%s: %s", s.Code(), s.Message()) 1964} 1965 1966// Status code returns the HTTP status code for the request's response error. 1967func (s *DependencyFailedException) StatusCode() int { 1968 return s.RespMetadata.StatusCode 1969} 1970 1971// RequestID returns the service's response RequestID for request. 1972func (s *DependencyFailedException) RequestID() string { 1973 return s.RespMetadata.RequestID 1974} 1975 1976// The next action that Amazon Lex should take. 1977type DialogAction struct { 1978 _ struct{} `type:"structure"` 1979 1980 // The name of the slot that should be elicited from the user. 1981 SlotToElicit *string `locationName:"slotToElicit" min:"1" type:"string"` 1982 1983 // The next action that the bot should take in its interaction with the user. 1984 // The possible values are: 1985 // 1986 // * Close - Indicates that there will not be a response from the user. For 1987 // example, the statement "Your order has been placed" does not require a 1988 // response. 1989 // 1990 // * ConfirmIntent - The next action is asking the user if the intent is 1991 // complete and ready to be fulfilled. This is a yes/no question such as 1992 // "Place the order?" 1993 // 1994 // * Delegate - The next action is determined by Amazon Lex. 1995 // 1996 // * ElicitSlot - The next action is to elicit a slot value from the user. 1997 // 1998 // Type is a required field 1999 Type *string `locationName:"type" type:"string" required:"true" enum:"DialogActionType"` 2000} 2001 2002// String returns the string representation 2003func (s DialogAction) String() string { 2004 return awsutil.Prettify(s) 2005} 2006 2007// GoString returns the string representation 2008func (s DialogAction) GoString() string { 2009 return s.String() 2010} 2011 2012// Validate inspects the fields of the type to determine if they are valid. 2013func (s *DialogAction) Validate() error { 2014 invalidParams := request.ErrInvalidParams{Context: "DialogAction"} 2015 if s.SlotToElicit != nil && len(*s.SlotToElicit) < 1 { 2016 invalidParams.Add(request.NewErrParamMinLen("SlotToElicit", 1)) 2017 } 2018 if s.Type == nil { 2019 invalidParams.Add(request.NewErrParamRequired("Type")) 2020 } 2021 2022 if invalidParams.Len() > 0 { 2023 return invalidParams 2024 } 2025 return nil 2026} 2027 2028// SetSlotToElicit sets the SlotToElicit field's value. 2029func (s *DialogAction) SetSlotToElicit(v string) *DialogAction { 2030 s.SlotToElicit = &v 2031 return s 2032} 2033 2034// SetType sets the Type field's value. 2035func (s *DialogAction) SetType(v string) *DialogAction { 2036 s.Type = &v 2037 return s 2038} 2039 2040// A notification from the client that it is disconnecting from Amazon Lex. 2041// Sending a DisconnectionEvent event is optional, but can help identify a conversation 2042// in logs. 2043type DisconnectionEvent struct { 2044 _ struct{} `type:"structure"` 2045 2046 // A timestamp set by the client of the date and time that the event was sent 2047 // to Amazon Lex. 2048 ClientTimestampMillis *int64 `locationName:"clientTimestampMillis" type:"long"` 2049 2050 // A unique identifier that your application assigns to the event. You can use 2051 // this to identify events in logs. 2052 EventId *string `locationName:"eventId" min:"2" type:"string"` 2053} 2054 2055// String returns the string representation 2056func (s DisconnectionEvent) String() string { 2057 return awsutil.Prettify(s) 2058} 2059 2060// GoString returns the string representation 2061func (s DisconnectionEvent) GoString() string { 2062 return s.String() 2063} 2064 2065// SetClientTimestampMillis sets the ClientTimestampMillis field's value. 2066func (s *DisconnectionEvent) SetClientTimestampMillis(v int64) *DisconnectionEvent { 2067 s.ClientTimestampMillis = &v 2068 return s 2069} 2070 2071// SetEventId sets the EventId field's value. 2072func (s *DisconnectionEvent) SetEventId(v string) *DisconnectionEvent { 2073 s.EventId = &v 2074 return s 2075} 2076 2077// The DisconnectionEvent is and event in the StartConversationRequestEventStream group of events. 2078func (s *DisconnectionEvent) eventStartConversationRequestEventStream() {} 2079 2080// UnmarshalEvent unmarshals the EventStream Message into the DisconnectionEvent value. 2081// This method is only used internally within the SDK's EventStream handling. 2082func (s *DisconnectionEvent) UnmarshalEvent( 2083 payloadUnmarshaler protocol.PayloadUnmarshaler, 2084 msg eventstream.Message, 2085) error { 2086 if err := payloadUnmarshaler.UnmarshalPayload( 2087 bytes.NewReader(msg.Payload), s, 2088 ); err != nil { 2089 return err 2090 } 2091 return nil 2092} 2093 2094// MarshalEvent marshals the type into an stream event value. This method 2095// should only used internally within the SDK's EventStream handling. 2096func (s *DisconnectionEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { 2097 msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType)) 2098 var buf bytes.Buffer 2099 if err = pm.MarshalPayload(&buf, s); err != nil { 2100 return eventstream.Message{}, err 2101 } 2102 msg.Payload = buf.Bytes() 2103 return msg, err 2104} 2105 2106type GetSessionInput struct { 2107 _ struct{} `type:"structure"` 2108 2109 // The alias identifier in use for the bot that contains the session data. 2110 // 2111 // BotAliasId is a required field 2112 BotAliasId *string `location:"uri" locationName:"botAliasId" type:"string" required:"true"` 2113 2114 // The identifier of the bot that contains the session data. 2115 // 2116 // BotId is a required field 2117 BotId *string `location:"uri" locationName:"botId" min:"10" type:"string" required:"true"` 2118 2119 // The locale where the session is in use. 2120 // 2121 // LocaleId is a required field 2122 LocaleId *string `location:"uri" locationName:"localeId" min:"1" type:"string" required:"true"` 2123 2124 // The identifier of the session to return. 2125 // 2126 // SessionId is a required field 2127 SessionId *string `location:"uri" locationName:"sessionId" min:"2" type:"string" required:"true"` 2128} 2129 2130// String returns the string representation 2131func (s GetSessionInput) String() string { 2132 return awsutil.Prettify(s) 2133} 2134 2135// GoString returns the string representation 2136func (s GetSessionInput) GoString() string { 2137 return s.String() 2138} 2139 2140// Validate inspects the fields of the type to determine if they are valid. 2141func (s *GetSessionInput) Validate() error { 2142 invalidParams := request.ErrInvalidParams{Context: "GetSessionInput"} 2143 if s.BotAliasId == nil { 2144 invalidParams.Add(request.NewErrParamRequired("BotAliasId")) 2145 } 2146 if s.BotAliasId != nil && len(*s.BotAliasId) < 1 { 2147 invalidParams.Add(request.NewErrParamMinLen("BotAliasId", 1)) 2148 } 2149 if s.BotId == nil { 2150 invalidParams.Add(request.NewErrParamRequired("BotId")) 2151 } 2152 if s.BotId != nil && len(*s.BotId) < 10 { 2153 invalidParams.Add(request.NewErrParamMinLen("BotId", 10)) 2154 } 2155 if s.LocaleId == nil { 2156 invalidParams.Add(request.NewErrParamRequired("LocaleId")) 2157 } 2158 if s.LocaleId != nil && len(*s.LocaleId) < 1 { 2159 invalidParams.Add(request.NewErrParamMinLen("LocaleId", 1)) 2160 } 2161 if s.SessionId == nil { 2162 invalidParams.Add(request.NewErrParamRequired("SessionId")) 2163 } 2164 if s.SessionId != nil && len(*s.SessionId) < 2 { 2165 invalidParams.Add(request.NewErrParamMinLen("SessionId", 2)) 2166 } 2167 2168 if invalidParams.Len() > 0 { 2169 return invalidParams 2170 } 2171 return nil 2172} 2173 2174// SetBotAliasId sets the BotAliasId field's value. 2175func (s *GetSessionInput) SetBotAliasId(v string) *GetSessionInput { 2176 s.BotAliasId = &v 2177 return s 2178} 2179 2180// SetBotId sets the BotId field's value. 2181func (s *GetSessionInput) SetBotId(v string) *GetSessionInput { 2182 s.BotId = &v 2183 return s 2184} 2185 2186// SetLocaleId sets the LocaleId field's value. 2187func (s *GetSessionInput) SetLocaleId(v string) *GetSessionInput { 2188 s.LocaleId = &v 2189 return s 2190} 2191 2192// SetSessionId sets the SessionId field's value. 2193func (s *GetSessionInput) SetSessionId(v string) *GetSessionInput { 2194 s.SessionId = &v 2195 return s 2196} 2197 2198type GetSessionOutput struct { 2199 _ struct{} `type:"structure"` 2200 2201 // A list of intents that Amazon Lex determined might satisfy the user's utterance. 2202 // 2203 // Each interpretation includes the intent, a score that indicates how confident 2204 // Amazon Lex is that the interpretation is the correct one, and an optional 2205 // sentiment response that indicates the sentiment expressed in the utterance. 2206 Interpretations []*Interpretation `locationName:"interpretations" type:"list"` 2207 2208 // A list of messages that were last sent to the user. The messages are ordered 2209 // based on the order that your returned the messages from your Lambda function 2210 // or the order that messages are defined in the bot. 2211 Messages []*Message `locationName:"messages" type:"list"` 2212 2213 // The identifier of the returned session. 2214 SessionId *string `locationName:"sessionId" min:"1" type:"string"` 2215 2216 // Represents the current state of the dialog between the user and the bot. 2217 // 2218 // You can use this to determine the progress of the conversation and what the 2219 // next action might be. 2220 SessionState *SessionState `locationName:"sessionState" type:"structure"` 2221} 2222 2223// String returns the string representation 2224func (s GetSessionOutput) String() string { 2225 return awsutil.Prettify(s) 2226} 2227 2228// GoString returns the string representation 2229func (s GetSessionOutput) GoString() string { 2230 return s.String() 2231} 2232 2233// SetInterpretations sets the Interpretations field's value. 2234func (s *GetSessionOutput) SetInterpretations(v []*Interpretation) *GetSessionOutput { 2235 s.Interpretations = v 2236 return s 2237} 2238 2239// SetMessages sets the Messages field's value. 2240func (s *GetSessionOutput) SetMessages(v []*Message) *GetSessionOutput { 2241 s.Messages = v 2242 return s 2243} 2244 2245// SetSessionId sets the SessionId field's value. 2246func (s *GetSessionOutput) SetSessionId(v string) *GetSessionOutput { 2247 s.SessionId = &v 2248 return s 2249} 2250 2251// SetSessionState sets the SessionState field's value. 2252func (s *GetSessionOutput) SetSessionState(v *SessionState) *GetSessionOutput { 2253 s.SessionState = v 2254 return s 2255} 2256 2257// Event that Amazon Lex sends to indicate that the stream is still open between 2258// the client application and Amazon Lex 2259type HeartbeatEvent struct { 2260 _ struct{} `type:"structure"` 2261 2262 // A unique identifier of the event sent by Amazon Lex. The identifier is in 2263 // the form RESPONSE-N, where N is a number starting with one and incremented 2264 // for each event sent by Amazon Lex in the current session. 2265 EventId *string `locationName:"eventId" min:"2" type:"string"` 2266} 2267 2268// String returns the string representation 2269func (s HeartbeatEvent) String() string { 2270 return awsutil.Prettify(s) 2271} 2272 2273// GoString returns the string representation 2274func (s HeartbeatEvent) GoString() string { 2275 return s.String() 2276} 2277 2278// SetEventId sets the EventId field's value. 2279func (s *HeartbeatEvent) SetEventId(v string) *HeartbeatEvent { 2280 s.EventId = &v 2281 return s 2282} 2283 2284// The HeartbeatEvent is and event in the StartConversationResponseEventStream group of events. 2285func (s *HeartbeatEvent) eventStartConversationResponseEventStream() {} 2286 2287// UnmarshalEvent unmarshals the EventStream Message into the HeartbeatEvent value. 2288// This method is only used internally within the SDK's EventStream handling. 2289func (s *HeartbeatEvent) UnmarshalEvent( 2290 payloadUnmarshaler protocol.PayloadUnmarshaler, 2291 msg eventstream.Message, 2292) error { 2293 if err := payloadUnmarshaler.UnmarshalPayload( 2294 bytes.NewReader(msg.Payload), s, 2295 ); err != nil { 2296 return err 2297 } 2298 return nil 2299} 2300 2301// MarshalEvent marshals the type into an stream event value. This method 2302// should only used internally within the SDK's EventStream handling. 2303func (s *HeartbeatEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { 2304 msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType)) 2305 var buf bytes.Buffer 2306 if err = pm.MarshalPayload(&buf, s); err != nil { 2307 return eventstream.Message{}, err 2308 } 2309 msg.Payload = buf.Bytes() 2310 return msg, err 2311} 2312 2313// A card that is shown to the user by a messaging platform. You define the 2314// contents of the card, the card is displayed by the platform. 2315// 2316// When you use a response card, the response from the user is constrained to 2317// the text associated with a button on the card. 2318type ImageResponseCard struct { 2319 _ struct{} `type:"structure"` 2320 2321 // A list of buttons that should be displayed on the response card. The arrangement 2322 // of the buttons is determined by the platform that displays the button. 2323 Buttons []*Button `locationName:"buttons" type:"list"` 2324 2325 // The URL of an image to display on the response card. The image URL must be 2326 // publicly available so that the platform displaying the response card has 2327 // access to the image. 2328 ImageUrl *string `locationName:"imageUrl" min:"1" type:"string"` 2329 2330 // The subtitle to display on the response card. The format of the subtitle 2331 // is determined by the platform displaying the response card. 2332 Subtitle *string `locationName:"subtitle" min:"1" type:"string"` 2333 2334 // The title to display on the response card. The format of the title is determined 2335 // by the platform displaying the response card. 2336 // 2337 // Title is a required field 2338 Title *string `locationName:"title" min:"1" type:"string" required:"true"` 2339} 2340 2341// String returns the string representation 2342func (s ImageResponseCard) String() string { 2343 return awsutil.Prettify(s) 2344} 2345 2346// GoString returns the string representation 2347func (s ImageResponseCard) GoString() string { 2348 return s.String() 2349} 2350 2351// Validate inspects the fields of the type to determine if they are valid. 2352func (s *ImageResponseCard) Validate() error { 2353 invalidParams := request.ErrInvalidParams{Context: "ImageResponseCard"} 2354 if s.ImageUrl != nil && len(*s.ImageUrl) < 1 { 2355 invalidParams.Add(request.NewErrParamMinLen("ImageUrl", 1)) 2356 } 2357 if s.Subtitle != nil && len(*s.Subtitle) < 1 { 2358 invalidParams.Add(request.NewErrParamMinLen("Subtitle", 1)) 2359 } 2360 if s.Title == nil { 2361 invalidParams.Add(request.NewErrParamRequired("Title")) 2362 } 2363 if s.Title != nil && len(*s.Title) < 1 { 2364 invalidParams.Add(request.NewErrParamMinLen("Title", 1)) 2365 } 2366 if s.Buttons != nil { 2367 for i, v := range s.Buttons { 2368 if v == nil { 2369 continue 2370 } 2371 if err := v.Validate(); err != nil { 2372 invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Buttons", i), err.(request.ErrInvalidParams)) 2373 } 2374 } 2375 } 2376 2377 if invalidParams.Len() > 0 { 2378 return invalidParams 2379 } 2380 return nil 2381} 2382 2383// SetButtons sets the Buttons field's value. 2384func (s *ImageResponseCard) SetButtons(v []*Button) *ImageResponseCard { 2385 s.Buttons = v 2386 return s 2387} 2388 2389// SetImageUrl sets the ImageUrl field's value. 2390func (s *ImageResponseCard) SetImageUrl(v string) *ImageResponseCard { 2391 s.ImageUrl = &v 2392 return s 2393} 2394 2395// SetSubtitle sets the Subtitle field's value. 2396func (s *ImageResponseCard) SetSubtitle(v string) *ImageResponseCard { 2397 s.Subtitle = &v 2398 return s 2399} 2400 2401// SetTitle sets the Title field's value. 2402func (s *ImageResponseCard) SetTitle(v string) *ImageResponseCard { 2403 s.Title = &v 2404 return s 2405} 2406 2407// The current intent that Amazon Lex is attempting to fulfill. 2408type Intent struct { 2409 _ struct{} `type:"structure"` 2410 2411 // Contains information about whether fulfillment of the intent has been confirmed. 2412 ConfirmationState *string `locationName:"confirmationState" type:"string" enum:"ConfirmationState"` 2413 2414 // The name of the intent. 2415 // 2416 // Name is a required field 2417 Name *string `locationName:"name" min:"1" type:"string" required:"true"` 2418 2419 // A map of all of the slots for the intent. The name of the slot maps to the 2420 // value of the slot. If a slot has not been filled, the value is null. 2421 Slots map[string]*Slot `locationName:"slots" type:"map"` 2422 2423 // Contains fulfillment information for the intent. 2424 State *string `locationName:"state" type:"string" enum:"IntentState"` 2425} 2426 2427// String returns the string representation 2428func (s Intent) String() string { 2429 return awsutil.Prettify(s) 2430} 2431 2432// GoString returns the string representation 2433func (s Intent) GoString() string { 2434 return s.String() 2435} 2436 2437// Validate inspects the fields of the type to determine if they are valid. 2438func (s *Intent) Validate() error { 2439 invalidParams := request.ErrInvalidParams{Context: "Intent"} 2440 if s.Name == nil { 2441 invalidParams.Add(request.NewErrParamRequired("Name")) 2442 } 2443 if s.Name != nil && len(*s.Name) < 1 { 2444 invalidParams.Add(request.NewErrParamMinLen("Name", 1)) 2445 } 2446 if s.Slots != nil { 2447 for i, v := range s.Slots { 2448 if v == nil { 2449 continue 2450 } 2451 if err := v.Validate(); err != nil { 2452 invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Slots", i), err.(request.ErrInvalidParams)) 2453 } 2454 } 2455 } 2456 2457 if invalidParams.Len() > 0 { 2458 return invalidParams 2459 } 2460 return nil 2461} 2462 2463// SetConfirmationState sets the ConfirmationState field's value. 2464func (s *Intent) SetConfirmationState(v string) *Intent { 2465 s.ConfirmationState = &v 2466 return s 2467} 2468 2469// SetName sets the Name field's value. 2470func (s *Intent) SetName(v string) *Intent { 2471 s.Name = &v 2472 return s 2473} 2474 2475// SetSlots sets the Slots field's value. 2476func (s *Intent) SetSlots(v map[string]*Slot) *Intent { 2477 s.Slots = v 2478 return s 2479} 2480 2481// SetState sets the State field's value. 2482func (s *Intent) SetState(v string) *Intent { 2483 s.State = &v 2484 return s 2485} 2486 2487// Contains the current state of the conversation between the client application 2488// and Amazon Lex. 2489type IntentResultEvent struct { 2490 _ struct{} `type:"structure"` 2491 2492 // A unique identifier of the event sent by Amazon Lex. The identifier is in 2493 // the form RESPONSE-N, where N is a number starting with one and incremented 2494 // for each event sent by Amazon Lex in the current session. 2495 EventId *string `locationName:"eventId" min:"2" type:"string"` 2496 2497 // Indicates whether the input to the operation was text or speech. 2498 InputMode *string `locationName:"inputMode" type:"string" enum:"InputMode"` 2499 2500 // A list of intents that Amazon Lex determined might satisfy the user's utterance. 2501 // 2502 // Each interpretation includes the intent, a score that indicates how confident 2503 // Amazon Lex is that the interpretation is the correct one, and an optional 2504 // sentiment response that indicates the sentiment expressed in the utterance. 2505 Interpretations []*Interpretation `locationName:"interpretations" type:"list"` 2506 2507 // The attributes sent in the request. 2508 RequestAttributes map[string]*string `locationName:"requestAttributes" type:"map"` 2509 2510 // The identifier of the session in use. 2511 SessionId *string `locationName:"sessionId" min:"2" type:"string"` 2512 2513 // The state of the user's session with Amazon Lex. 2514 SessionState *SessionState `locationName:"sessionState" type:"structure"` 2515} 2516 2517// String returns the string representation 2518func (s IntentResultEvent) String() string { 2519 return awsutil.Prettify(s) 2520} 2521 2522// GoString returns the string representation 2523func (s IntentResultEvent) GoString() string { 2524 return s.String() 2525} 2526 2527// SetEventId sets the EventId field's value. 2528func (s *IntentResultEvent) SetEventId(v string) *IntentResultEvent { 2529 s.EventId = &v 2530 return s 2531} 2532 2533// SetInputMode sets the InputMode field's value. 2534func (s *IntentResultEvent) SetInputMode(v string) *IntentResultEvent { 2535 s.InputMode = &v 2536 return s 2537} 2538 2539// SetInterpretations sets the Interpretations field's value. 2540func (s *IntentResultEvent) SetInterpretations(v []*Interpretation) *IntentResultEvent { 2541 s.Interpretations = v 2542 return s 2543} 2544 2545// SetRequestAttributes sets the RequestAttributes field's value. 2546func (s *IntentResultEvent) SetRequestAttributes(v map[string]*string) *IntentResultEvent { 2547 s.RequestAttributes = v 2548 return s 2549} 2550 2551// SetSessionId sets the SessionId field's value. 2552func (s *IntentResultEvent) SetSessionId(v string) *IntentResultEvent { 2553 s.SessionId = &v 2554 return s 2555} 2556 2557// SetSessionState sets the SessionState field's value. 2558func (s *IntentResultEvent) SetSessionState(v *SessionState) *IntentResultEvent { 2559 s.SessionState = v 2560 return s 2561} 2562 2563// The IntentResultEvent is and event in the StartConversationResponseEventStream group of events. 2564func (s *IntentResultEvent) eventStartConversationResponseEventStream() {} 2565 2566// UnmarshalEvent unmarshals the EventStream Message into the IntentResultEvent value. 2567// This method is only used internally within the SDK's EventStream handling. 2568func (s *IntentResultEvent) UnmarshalEvent( 2569 payloadUnmarshaler protocol.PayloadUnmarshaler, 2570 msg eventstream.Message, 2571) error { 2572 if err := payloadUnmarshaler.UnmarshalPayload( 2573 bytes.NewReader(msg.Payload), s, 2574 ); err != nil { 2575 return err 2576 } 2577 return nil 2578} 2579 2580// MarshalEvent marshals the type into an stream event value. This method 2581// should only used internally within the SDK's EventStream handling. 2582func (s *IntentResultEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { 2583 msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType)) 2584 var buf bytes.Buffer 2585 if err = pm.MarshalPayload(&buf, s); err != nil { 2586 return eventstream.Message{}, err 2587 } 2588 msg.Payload = buf.Bytes() 2589 return msg, err 2590} 2591 2592type InternalServerException struct { 2593 _ struct{} `type:"structure"` 2594 RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` 2595 2596 Message_ *string `locationName:"message" type:"string"` 2597} 2598 2599// String returns the string representation 2600func (s InternalServerException) String() string { 2601 return awsutil.Prettify(s) 2602} 2603 2604// GoString returns the string representation 2605func (s InternalServerException) GoString() string { 2606 return s.String() 2607} 2608 2609// The InternalServerException is and event in the StartConversationResponseEventStream group of events. 2610func (s *InternalServerException) eventStartConversationResponseEventStream() {} 2611 2612// UnmarshalEvent unmarshals the EventStream Message into the InternalServerException value. 2613// This method is only used internally within the SDK's EventStream handling. 2614func (s *InternalServerException) UnmarshalEvent( 2615 payloadUnmarshaler protocol.PayloadUnmarshaler, 2616 msg eventstream.Message, 2617) error { 2618 if err := payloadUnmarshaler.UnmarshalPayload( 2619 bytes.NewReader(msg.Payload), s, 2620 ); err != nil { 2621 return err 2622 } 2623 return nil 2624} 2625 2626// MarshalEvent marshals the type into an stream event value. This method 2627// should only used internally within the SDK's EventStream handling. 2628func (s *InternalServerException) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { 2629 msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.ExceptionMessageType)) 2630 var buf bytes.Buffer 2631 if err = pm.MarshalPayload(&buf, s); err != nil { 2632 return eventstream.Message{}, err 2633 } 2634 msg.Payload = buf.Bytes() 2635 return msg, err 2636} 2637 2638func newErrorInternalServerException(v protocol.ResponseMetadata) error { 2639 return &InternalServerException{ 2640 RespMetadata: v, 2641 } 2642} 2643 2644// Code returns the exception type name. 2645func (s *InternalServerException) Code() string { 2646 return "InternalServerException" 2647} 2648 2649// Message returns the exception's message. 2650func (s *InternalServerException) Message() string { 2651 if s.Message_ != nil { 2652 return *s.Message_ 2653 } 2654 return "" 2655} 2656 2657// OrigErr always returns nil, satisfies awserr.Error interface. 2658func (s *InternalServerException) OrigErr() error { 2659 return nil 2660} 2661 2662func (s *InternalServerException) Error() string { 2663 return fmt.Sprintf("%s: %s", s.Code(), s.Message()) 2664} 2665 2666// Status code returns the HTTP status code for the request's response error. 2667func (s *InternalServerException) StatusCode() int { 2668 return s.RespMetadata.StatusCode 2669} 2670 2671// RequestID returns the service's response RequestID for request. 2672func (s *InternalServerException) RequestID() string { 2673 return s.RespMetadata.RequestID 2674} 2675 2676// An intent that Amazon Lex determined might satisfy the user's utterance. 2677// The intents are ordered by the confidence score. 2678type Interpretation struct { 2679 _ struct{} `type:"structure"` 2680 2681 // A list of intents that might satisfy the user's utterance. The intents are 2682 // ordered by the confidence score. 2683 Intent *Intent `locationName:"intent" type:"structure"` 2684 2685 // Determines the threshold where Amazon Lex will insert the AMAZON.FallbackIntent, 2686 // AMAZON.KendraSearchIntent, or both when returning alternative intents in 2687 // a response. AMAZON.FallbackIntent and AMAZON.KendraSearchIntent are only 2688 // inserted if they are configured for the bot. 2689 NluConfidence *ConfidenceScore `locationName:"nluConfidence" type:"structure"` 2690 2691 // The sentiment expressed in an utterance. 2692 // 2693 // When the bot is configured to send utterances to Amazon Comprehend for sentiment 2694 // analysis, this field contains the result of the analysis. 2695 SentimentResponse *SentimentResponse `locationName:"sentimentResponse" type:"structure"` 2696} 2697 2698// String returns the string representation 2699func (s Interpretation) String() string { 2700 return awsutil.Prettify(s) 2701} 2702 2703// GoString returns the string representation 2704func (s Interpretation) GoString() string { 2705 return s.String() 2706} 2707 2708// SetIntent sets the Intent field's value. 2709func (s *Interpretation) SetIntent(v *Intent) *Interpretation { 2710 s.Intent = v 2711 return s 2712} 2713 2714// SetNluConfidence sets the NluConfidence field's value. 2715func (s *Interpretation) SetNluConfidence(v *ConfidenceScore) *Interpretation { 2716 s.NluConfidence = v 2717 return s 2718} 2719 2720// SetSentimentResponse sets the SentimentResponse field's value. 2721func (s *Interpretation) SetSentimentResponse(v *SentimentResponse) *Interpretation { 2722 s.SentimentResponse = v 2723 return s 2724} 2725 2726// Container for text that is returned to the customer.. 2727type Message struct { 2728 _ struct{} `type:"structure"` 2729 2730 // The text of the message. 2731 Content *string `locationName:"content" min:"1" type:"string" sensitive:"true"` 2732 2733 // Indicates the type of response. 2734 ContentType *string `locationName:"contentType" type:"string" enum:"MessageContentType"` 2735 2736 // A card that is shown to the user by a messaging platform. You define the 2737 // contents of the card, the card is displayed by the platform. 2738 // 2739 // When you use a response card, the response from the user is constrained to 2740 // the text associated with a button on the card. 2741 ImageResponseCard *ImageResponseCard `locationName:"imageResponseCard" type:"structure"` 2742} 2743 2744// String returns the string representation 2745func (s Message) String() string { 2746 return awsutil.Prettify(s) 2747} 2748 2749// GoString returns the string representation 2750func (s Message) GoString() string { 2751 return s.String() 2752} 2753 2754// Validate inspects the fields of the type to determine if they are valid. 2755func (s *Message) Validate() error { 2756 invalidParams := request.ErrInvalidParams{Context: "Message"} 2757 if s.Content != nil && len(*s.Content) < 1 { 2758 invalidParams.Add(request.NewErrParamMinLen("Content", 1)) 2759 } 2760 if s.ImageResponseCard != nil { 2761 if err := s.ImageResponseCard.Validate(); err != nil { 2762 invalidParams.AddNested("ImageResponseCard", err.(request.ErrInvalidParams)) 2763 } 2764 } 2765 2766 if invalidParams.Len() > 0 { 2767 return invalidParams 2768 } 2769 return nil 2770} 2771 2772// SetContent sets the Content field's value. 2773func (s *Message) SetContent(v string) *Message { 2774 s.Content = &v 2775 return s 2776} 2777 2778// SetContentType sets the ContentType field's value. 2779func (s *Message) SetContentType(v string) *Message { 2780 s.ContentType = &v 2781 return s 2782} 2783 2784// SetImageResponseCard sets the ImageResponseCard field's value. 2785func (s *Message) SetImageResponseCard(v *ImageResponseCard) *Message { 2786 s.ImageResponseCard = v 2787 return s 2788} 2789 2790// Event sent from the client application to Amazon Lex to indicate that playback 2791// of audio is complete and that Amazon Lex should start processing the user's 2792// input. 2793type PlaybackCompletionEvent struct { 2794 _ struct{} `type:"structure"` 2795 2796 // A timestamp set by the client of the date and time that the event was sent 2797 // to Amazon Lex. 2798 ClientTimestampMillis *int64 `locationName:"clientTimestampMillis" type:"long"` 2799 2800 // A unique identifier that your application assigns to the event. You can use 2801 // this to identify events in logs. 2802 EventId *string `locationName:"eventId" min:"2" type:"string"` 2803} 2804 2805// String returns the string representation 2806func (s PlaybackCompletionEvent) String() string { 2807 return awsutil.Prettify(s) 2808} 2809 2810// GoString returns the string representation 2811func (s PlaybackCompletionEvent) GoString() string { 2812 return s.String() 2813} 2814 2815// SetClientTimestampMillis sets the ClientTimestampMillis field's value. 2816func (s *PlaybackCompletionEvent) SetClientTimestampMillis(v int64) *PlaybackCompletionEvent { 2817 s.ClientTimestampMillis = &v 2818 return s 2819} 2820 2821// SetEventId sets the EventId field's value. 2822func (s *PlaybackCompletionEvent) SetEventId(v string) *PlaybackCompletionEvent { 2823 s.EventId = &v 2824 return s 2825} 2826 2827// The PlaybackCompletionEvent is and event in the StartConversationRequestEventStream group of events. 2828func (s *PlaybackCompletionEvent) eventStartConversationRequestEventStream() {} 2829 2830// UnmarshalEvent unmarshals the EventStream Message into the PlaybackCompletionEvent value. 2831// This method is only used internally within the SDK's EventStream handling. 2832func (s *PlaybackCompletionEvent) UnmarshalEvent( 2833 payloadUnmarshaler protocol.PayloadUnmarshaler, 2834 msg eventstream.Message, 2835) error { 2836 if err := payloadUnmarshaler.UnmarshalPayload( 2837 bytes.NewReader(msg.Payload), s, 2838 ); err != nil { 2839 return err 2840 } 2841 return nil 2842} 2843 2844// MarshalEvent marshals the type into an stream event value. This method 2845// should only used internally within the SDK's EventStream handling. 2846func (s *PlaybackCompletionEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { 2847 msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType)) 2848 var buf bytes.Buffer 2849 if err = pm.MarshalPayload(&buf, s); err != nil { 2850 return eventstream.Message{}, err 2851 } 2852 msg.Payload = buf.Bytes() 2853 return msg, err 2854} 2855 2856// Event sent from Amazon Lex to indicate to the client application should stop 2857// playback of audio. For example, if the client is playing a prompt that asks 2858// for the user's telephone number, the user might start to say the phone number 2859// before the prompt is complete. Amazon Lex sends this event to the client 2860// application to indicate that the user is responding and that Amazon Lex is 2861// processing their input. 2862type PlaybackInterruptionEvent struct { 2863 _ struct{} `type:"structure"` 2864 2865 // The identifier of the event that contained the audio, DTMF, or text that 2866 // caused the interruption. 2867 CausedByEventId *string `locationName:"causedByEventId" min:"2" type:"string"` 2868 2869 // A unique identifier of the event sent by Amazon Lex. The identifier is in 2870 // the form RESPONSE-N, where N is a number starting with one and incremented 2871 // for each event sent by Amazon Lex in the current session. 2872 EventId *string `locationName:"eventId" min:"2" type:"string"` 2873 2874 // Indicates the type of user input that Amazon Lex detected. 2875 EventReason *string `locationName:"eventReason" type:"string" enum:"PlaybackInterruptionReason"` 2876} 2877 2878// String returns the string representation 2879func (s PlaybackInterruptionEvent) String() string { 2880 return awsutil.Prettify(s) 2881} 2882 2883// GoString returns the string representation 2884func (s PlaybackInterruptionEvent) GoString() string { 2885 return s.String() 2886} 2887 2888// SetCausedByEventId sets the CausedByEventId field's value. 2889func (s *PlaybackInterruptionEvent) SetCausedByEventId(v string) *PlaybackInterruptionEvent { 2890 s.CausedByEventId = &v 2891 return s 2892} 2893 2894// SetEventId sets the EventId field's value. 2895func (s *PlaybackInterruptionEvent) SetEventId(v string) *PlaybackInterruptionEvent { 2896 s.EventId = &v 2897 return s 2898} 2899 2900// SetEventReason sets the EventReason field's value. 2901func (s *PlaybackInterruptionEvent) SetEventReason(v string) *PlaybackInterruptionEvent { 2902 s.EventReason = &v 2903 return s 2904} 2905 2906// The PlaybackInterruptionEvent is and event in the StartConversationResponseEventStream group of events. 2907func (s *PlaybackInterruptionEvent) eventStartConversationResponseEventStream() {} 2908 2909// UnmarshalEvent unmarshals the EventStream Message into the PlaybackInterruptionEvent value. 2910// This method is only used internally within the SDK's EventStream handling. 2911func (s *PlaybackInterruptionEvent) UnmarshalEvent( 2912 payloadUnmarshaler protocol.PayloadUnmarshaler, 2913 msg eventstream.Message, 2914) error { 2915 if err := payloadUnmarshaler.UnmarshalPayload( 2916 bytes.NewReader(msg.Payload), s, 2917 ); err != nil { 2918 return err 2919 } 2920 return nil 2921} 2922 2923// MarshalEvent marshals the type into an stream event value. This method 2924// should only used internally within the SDK's EventStream handling. 2925func (s *PlaybackInterruptionEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { 2926 msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType)) 2927 var buf bytes.Buffer 2928 if err = pm.MarshalPayload(&buf, s); err != nil { 2929 return eventstream.Message{}, err 2930 } 2931 msg.Payload = buf.Bytes() 2932 return msg, err 2933} 2934 2935type PutSessionInput struct { 2936 _ struct{} `type:"structure"` 2937 2938 // The alias identifier of the bot that receives the session data. 2939 // 2940 // BotAliasId is a required field 2941 BotAliasId *string `location:"uri" locationName:"botAliasId" type:"string" required:"true"` 2942 2943 // The identifier of the bot that receives the session data. 2944 // 2945 // BotId is a required field 2946 BotId *string `location:"uri" locationName:"botId" min:"10" type:"string" required:"true"` 2947 2948 // The locale where the session is in use. 2949 // 2950 // LocaleId is a required field 2951 LocaleId *string `location:"uri" locationName:"localeId" min:"1" type:"string" required:"true"` 2952 2953 // A list of messages to send to the user. Messages are sent in the order that 2954 // they are defined in the list. 2955 Messages []*Message `locationName:"messages" type:"list"` 2956 2957 // Request-specific information passed between Amazon Lex and the client application. 2958 // 2959 // The namespace x-amz-lex: is reserved for special attributes. Don't create 2960 // any request attributes with the prefix x-amz-lex:. 2961 RequestAttributes map[string]*string `locationName:"requestAttributes" type:"map"` 2962 2963 // The message that Amazon Lex returns in the response can be either text or 2964 // speech depending on the value of this parameter. 2965 // 2966 // * If the value is text/plain; charset=utf-8, Amazon Lex returns text in 2967 // the response. 2968 ResponseContentType *string `location:"header" locationName:"ResponseContentType" min:"1" type:"string"` 2969 2970 // The identifier of the session that receives the session data. 2971 // 2972 // SessionId is a required field 2973 SessionId *string `location:"uri" locationName:"sessionId" min:"2" type:"string" required:"true"` 2974 2975 // Sets the state of the session with the user. You can use this to set the 2976 // current intent, attributes, context, and dialog action. Use the dialog action 2977 // to determine the next step that Amazon Lex should use in the conversation 2978 // with the user. 2979 // 2980 // SessionState is a required field 2981 SessionState *SessionState `locationName:"sessionState" type:"structure" required:"true"` 2982} 2983 2984// String returns the string representation 2985func (s PutSessionInput) String() string { 2986 return awsutil.Prettify(s) 2987} 2988 2989// GoString returns the string representation 2990func (s PutSessionInput) GoString() string { 2991 return s.String() 2992} 2993 2994// Validate inspects the fields of the type to determine if they are valid. 2995func (s *PutSessionInput) Validate() error { 2996 invalidParams := request.ErrInvalidParams{Context: "PutSessionInput"} 2997 if s.BotAliasId == nil { 2998 invalidParams.Add(request.NewErrParamRequired("BotAliasId")) 2999 } 3000 if s.BotAliasId != nil && len(*s.BotAliasId) < 1 { 3001 invalidParams.Add(request.NewErrParamMinLen("BotAliasId", 1)) 3002 } 3003 if s.BotId == nil { 3004 invalidParams.Add(request.NewErrParamRequired("BotId")) 3005 } 3006 if s.BotId != nil && len(*s.BotId) < 10 { 3007 invalidParams.Add(request.NewErrParamMinLen("BotId", 10)) 3008 } 3009 if s.LocaleId == nil { 3010 invalidParams.Add(request.NewErrParamRequired("LocaleId")) 3011 } 3012 if s.LocaleId != nil && len(*s.LocaleId) < 1 { 3013 invalidParams.Add(request.NewErrParamMinLen("LocaleId", 1)) 3014 } 3015 if s.ResponseContentType != nil && len(*s.ResponseContentType) < 1 { 3016 invalidParams.Add(request.NewErrParamMinLen("ResponseContentType", 1)) 3017 } 3018 if s.SessionId == nil { 3019 invalidParams.Add(request.NewErrParamRequired("SessionId")) 3020 } 3021 if s.SessionId != nil && len(*s.SessionId) < 2 { 3022 invalidParams.Add(request.NewErrParamMinLen("SessionId", 2)) 3023 } 3024 if s.SessionState == nil { 3025 invalidParams.Add(request.NewErrParamRequired("SessionState")) 3026 } 3027 if s.Messages != nil { 3028 for i, v := range s.Messages { 3029 if v == nil { 3030 continue 3031 } 3032 if err := v.Validate(); err != nil { 3033 invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Messages", i), err.(request.ErrInvalidParams)) 3034 } 3035 } 3036 } 3037 if s.SessionState != nil { 3038 if err := s.SessionState.Validate(); err != nil { 3039 invalidParams.AddNested("SessionState", err.(request.ErrInvalidParams)) 3040 } 3041 } 3042 3043 if invalidParams.Len() > 0 { 3044 return invalidParams 3045 } 3046 return nil 3047} 3048 3049// SetBotAliasId sets the BotAliasId field's value. 3050func (s *PutSessionInput) SetBotAliasId(v string) *PutSessionInput { 3051 s.BotAliasId = &v 3052 return s 3053} 3054 3055// SetBotId sets the BotId field's value. 3056func (s *PutSessionInput) SetBotId(v string) *PutSessionInput { 3057 s.BotId = &v 3058 return s 3059} 3060 3061// SetLocaleId sets the LocaleId field's value. 3062func (s *PutSessionInput) SetLocaleId(v string) *PutSessionInput { 3063 s.LocaleId = &v 3064 return s 3065} 3066 3067// SetMessages sets the Messages field's value. 3068func (s *PutSessionInput) SetMessages(v []*Message) *PutSessionInput { 3069 s.Messages = v 3070 return s 3071} 3072 3073// SetRequestAttributes sets the RequestAttributes field's value. 3074func (s *PutSessionInput) SetRequestAttributes(v map[string]*string) *PutSessionInput { 3075 s.RequestAttributes = v 3076 return s 3077} 3078 3079// SetResponseContentType sets the ResponseContentType field's value. 3080func (s *PutSessionInput) SetResponseContentType(v string) *PutSessionInput { 3081 s.ResponseContentType = &v 3082 return s 3083} 3084 3085// SetSessionId sets the SessionId field's value. 3086func (s *PutSessionInput) SetSessionId(v string) *PutSessionInput { 3087 s.SessionId = &v 3088 return s 3089} 3090 3091// SetSessionState sets the SessionState field's value. 3092func (s *PutSessionInput) SetSessionState(v *SessionState) *PutSessionInput { 3093 s.SessionState = v 3094 return s 3095} 3096 3097type PutSessionOutput struct { 3098 _ struct{} `type:"structure" payload:"AudioStream"` 3099 3100 // If the requested content type was audio, the audio version of the message 3101 // to convey to the user. 3102 AudioStream io.ReadCloser `locationName:"audioStream" type:"blob"` 3103 3104 // The type of response. Same as the type specified in the responseContentType 3105 // field in the request. 3106 ContentType *string `location:"header" locationName:"Content-Type" min:"1" type:"string"` 3107 3108 // A list of messages that were last sent to the user. The messages are ordered 3109 // based on how you return the messages from you Lambda function or the order 3110 // that the messages are defined in the bot. 3111 Messages *string `location:"header" locationName:"x-amz-lex-messages" min:"1" type:"string"` 3112 3113 // Request-specific information passed between the client application and Amazon 3114 // Lex. These are the same as the requestAttribute parameter in the call to 3115 // the PutSession operation. 3116 RequestAttributes *string `location:"header" locationName:"x-amz-lex-request-attributes" min:"1" type:"string"` 3117 3118 // The identifier of the session that received the data. 3119 SessionId *string `location:"header" locationName:"x-amz-lex-session-id" min:"2" type:"string"` 3120 3121 // Represents the current state of the dialog between the user and the bot. 3122 // 3123 // Use this to determine the progress of the conversation and what the next 3124 // action may be. 3125 SessionState *string `location:"header" locationName:"x-amz-lex-session-state" min:"1" type:"string"` 3126} 3127 3128// String returns the string representation 3129func (s PutSessionOutput) String() string { 3130 return awsutil.Prettify(s) 3131} 3132 3133// GoString returns the string representation 3134func (s PutSessionOutput) GoString() string { 3135 return s.String() 3136} 3137 3138// SetAudioStream sets the AudioStream field's value. 3139func (s *PutSessionOutput) SetAudioStream(v io.ReadCloser) *PutSessionOutput { 3140 s.AudioStream = v 3141 return s 3142} 3143 3144// SetContentType sets the ContentType field's value. 3145func (s *PutSessionOutput) SetContentType(v string) *PutSessionOutput { 3146 s.ContentType = &v 3147 return s 3148} 3149 3150// SetMessages sets the Messages field's value. 3151func (s *PutSessionOutput) SetMessages(v string) *PutSessionOutput { 3152 s.Messages = &v 3153 return s 3154} 3155 3156// SetRequestAttributes sets the RequestAttributes field's value. 3157func (s *PutSessionOutput) SetRequestAttributes(v string) *PutSessionOutput { 3158 s.RequestAttributes = &v 3159 return s 3160} 3161 3162// SetSessionId sets the SessionId field's value. 3163func (s *PutSessionOutput) SetSessionId(v string) *PutSessionOutput { 3164 s.SessionId = &v 3165 return s 3166} 3167 3168// SetSessionState sets the SessionState field's value. 3169func (s *PutSessionOutput) SetSessionState(v string) *PutSessionOutput { 3170 s.SessionState = &v 3171 return s 3172} 3173 3174type RecognizeTextInput struct { 3175 _ struct{} `type:"structure"` 3176 3177 // The alias identifier in use for the bot that processes the request. 3178 // 3179 // BotAliasId is a required field 3180 BotAliasId *string `location:"uri" locationName:"botAliasId" type:"string" required:"true"` 3181 3182 // The identifier of the bot that processes the request. 3183 // 3184 // BotId is a required field 3185 BotId *string `location:"uri" locationName:"botId" min:"10" type:"string" required:"true"` 3186 3187 // The locale where the session is in use. 3188 // 3189 // LocaleId is a required field 3190 LocaleId *string `location:"uri" locationName:"localeId" min:"1" type:"string" required:"true"` 3191 3192 // Request-specific information passed between the client application and Amazon 3193 // Lex 3194 // 3195 // The namespace x-amz-lex: is reserved for special attributes. Don't create 3196 // any request attributes with the prefix x-amz-lex:. 3197 RequestAttributes map[string]*string `locationName:"requestAttributes" type:"map"` 3198 3199 // The identifier of the user session that is having the conversation. 3200 // 3201 // SessionId is a required field 3202 SessionId *string `location:"uri" locationName:"sessionId" min:"2" type:"string" required:"true"` 3203 3204 // The current state of the dialog between the user and the bot. 3205 SessionState *SessionState `locationName:"sessionState" type:"structure"` 3206 3207 // The text that the user entered. Amazon Lex interprets this text. 3208 // 3209 // Text is a required field 3210 Text *string `locationName:"text" min:"1" type:"string" required:"true" sensitive:"true"` 3211} 3212 3213// String returns the string representation 3214func (s RecognizeTextInput) String() string { 3215 return awsutil.Prettify(s) 3216} 3217 3218// GoString returns the string representation 3219func (s RecognizeTextInput) GoString() string { 3220 return s.String() 3221} 3222 3223// Validate inspects the fields of the type to determine if they are valid. 3224func (s *RecognizeTextInput) Validate() error { 3225 invalidParams := request.ErrInvalidParams{Context: "RecognizeTextInput"} 3226 if s.BotAliasId == nil { 3227 invalidParams.Add(request.NewErrParamRequired("BotAliasId")) 3228 } 3229 if s.BotAliasId != nil && len(*s.BotAliasId) < 1 { 3230 invalidParams.Add(request.NewErrParamMinLen("BotAliasId", 1)) 3231 } 3232 if s.BotId == nil { 3233 invalidParams.Add(request.NewErrParamRequired("BotId")) 3234 } 3235 if s.BotId != nil && len(*s.BotId) < 10 { 3236 invalidParams.Add(request.NewErrParamMinLen("BotId", 10)) 3237 } 3238 if s.LocaleId == nil { 3239 invalidParams.Add(request.NewErrParamRequired("LocaleId")) 3240 } 3241 if s.LocaleId != nil && len(*s.LocaleId) < 1 { 3242 invalidParams.Add(request.NewErrParamMinLen("LocaleId", 1)) 3243 } 3244 if s.SessionId == nil { 3245 invalidParams.Add(request.NewErrParamRequired("SessionId")) 3246 } 3247 if s.SessionId != nil && len(*s.SessionId) < 2 { 3248 invalidParams.Add(request.NewErrParamMinLen("SessionId", 2)) 3249 } 3250 if s.Text == nil { 3251 invalidParams.Add(request.NewErrParamRequired("Text")) 3252 } 3253 if s.Text != nil && len(*s.Text) < 1 { 3254 invalidParams.Add(request.NewErrParamMinLen("Text", 1)) 3255 } 3256 if s.SessionState != nil { 3257 if err := s.SessionState.Validate(); err != nil { 3258 invalidParams.AddNested("SessionState", err.(request.ErrInvalidParams)) 3259 } 3260 } 3261 3262 if invalidParams.Len() > 0 { 3263 return invalidParams 3264 } 3265 return nil 3266} 3267 3268// SetBotAliasId sets the BotAliasId field's value. 3269func (s *RecognizeTextInput) SetBotAliasId(v string) *RecognizeTextInput { 3270 s.BotAliasId = &v 3271 return s 3272} 3273 3274// SetBotId sets the BotId field's value. 3275func (s *RecognizeTextInput) SetBotId(v string) *RecognizeTextInput { 3276 s.BotId = &v 3277 return s 3278} 3279 3280// SetLocaleId sets the LocaleId field's value. 3281func (s *RecognizeTextInput) SetLocaleId(v string) *RecognizeTextInput { 3282 s.LocaleId = &v 3283 return s 3284} 3285 3286// SetRequestAttributes sets the RequestAttributes field's value. 3287func (s *RecognizeTextInput) SetRequestAttributes(v map[string]*string) *RecognizeTextInput { 3288 s.RequestAttributes = v 3289 return s 3290} 3291 3292// SetSessionId sets the SessionId field's value. 3293func (s *RecognizeTextInput) SetSessionId(v string) *RecognizeTextInput { 3294 s.SessionId = &v 3295 return s 3296} 3297 3298// SetSessionState sets the SessionState field's value. 3299func (s *RecognizeTextInput) SetSessionState(v *SessionState) *RecognizeTextInput { 3300 s.SessionState = v 3301 return s 3302} 3303 3304// SetText sets the Text field's value. 3305func (s *RecognizeTextInput) SetText(v string) *RecognizeTextInput { 3306 s.Text = &v 3307 return s 3308} 3309 3310type RecognizeTextOutput struct { 3311 _ struct{} `type:"structure"` 3312 3313 // A list of intents that Amazon Lex determined might satisfy the user's utterance. 3314 // 3315 // Each interpretation includes the intent, a score that indicates now confident 3316 // Amazon Lex is that the interpretation is the correct one, and an optional 3317 // sentiment response that indicates the sentiment expressed in the utterance. 3318 Interpretations []*Interpretation `locationName:"interpretations" type:"list"` 3319 3320 // A list of messages last sent to the user. The messages are ordered based 3321 // on the order that you returned the messages from your Lambda function or 3322 // the order that the messages are defined in the bot. 3323 Messages []*Message `locationName:"messages" type:"list"` 3324 3325 // The attributes sent in the request. 3326 RequestAttributes map[string]*string `locationName:"requestAttributes" type:"map"` 3327 3328 // The identifier of the session in use. 3329 SessionId *string `locationName:"sessionId" min:"2" type:"string"` 3330 3331 // Represents the current state of the dialog between the user and the bot. 3332 // 3333 // Use this to determine the progress of the conversation and what the next 3334 // action may be. 3335 SessionState *SessionState `locationName:"sessionState" type:"structure"` 3336} 3337 3338// String returns the string representation 3339func (s RecognizeTextOutput) String() string { 3340 return awsutil.Prettify(s) 3341} 3342 3343// GoString returns the string representation 3344func (s RecognizeTextOutput) GoString() string { 3345 return s.String() 3346} 3347 3348// SetInterpretations sets the Interpretations field's value. 3349func (s *RecognizeTextOutput) SetInterpretations(v []*Interpretation) *RecognizeTextOutput { 3350 s.Interpretations = v 3351 return s 3352} 3353 3354// SetMessages sets the Messages field's value. 3355func (s *RecognizeTextOutput) SetMessages(v []*Message) *RecognizeTextOutput { 3356 s.Messages = v 3357 return s 3358} 3359 3360// SetRequestAttributes sets the RequestAttributes field's value. 3361func (s *RecognizeTextOutput) SetRequestAttributes(v map[string]*string) *RecognizeTextOutput { 3362 s.RequestAttributes = v 3363 return s 3364} 3365 3366// SetSessionId sets the SessionId field's value. 3367func (s *RecognizeTextOutput) SetSessionId(v string) *RecognizeTextOutput { 3368 s.SessionId = &v 3369 return s 3370} 3371 3372// SetSessionState sets the SessionState field's value. 3373func (s *RecognizeTextOutput) SetSessionState(v *SessionState) *RecognizeTextOutput { 3374 s.SessionState = v 3375 return s 3376} 3377 3378type RecognizeUtteranceInput struct { 3379 _ struct{} `type:"structure" payload:"InputStream"` 3380 3381 // The alias identifier in use for the bot that should receive the request. 3382 // 3383 // BotAliasId is a required field 3384 BotAliasId *string `location:"uri" locationName:"botAliasId" type:"string" required:"true"` 3385 3386 // The identifier of the bot that should receive the request. 3387 // 3388 // BotId is a required field 3389 BotId *string `location:"uri" locationName:"botId" min:"10" type:"string" required:"true"` 3390 3391 // User input in PCM or Opus audio format or text format as described in the 3392 // requestContentType parameter. 3393 // 3394 // To use an non-seekable io.Reader for this request wrap the io.Reader with 3395 // "aws.ReadSeekCloser". The SDK will not retry request errors for non-seekable 3396 // readers. This will allow the SDK to send the reader's payload as chunked 3397 // transfer encoding. 3398 InputStream io.ReadSeeker `locationName:"inputStream" type:"blob"` 3399 3400 // The locale where the session is in use. 3401 // 3402 // LocaleId is a required field 3403 LocaleId *string `location:"uri" locationName:"localeId" min:"1" type:"string" required:"true"` 3404 3405 // Request-specific information passed between the client application and Amazon 3406 // Lex 3407 // 3408 // The namespace x-amz-lex: is reserved for special attributes. Don't create 3409 // any request attributes for prefix x-amz-lex:. 3410 RequestAttributes *string `location:"header" locationName:"x-amz-lex-request-attributes" type:"string" sensitive:"true"` 3411 3412 // Indicates the format for audio input or that the content is text. The header 3413 // must start with one of the following prefixes: 3414 // 3415 // * PCM format, audio data must be in little-endian byte order. audio/l16; 3416 // rate=16000; channels=1 audio/x-l16; sample-rate=16000; channel-count=1 3417 // audio/lpcm; sample-rate=8000; sample-size-bits=16; channel-count=1; is-big-endian=false 3418 // 3419 // * Opus format audio/x-cbr-opus-with-preamble;preamble-size=0;bit-rate=256000;frame-size-milliseconds=4 3420 // 3421 // * Text format text/plain; charset=utf-8 3422 // 3423 // RequestContentType is a required field 3424 RequestContentType *string `location:"header" locationName:"Content-Type" min:"1" type:"string" required:"true"` 3425 3426 // The message that Amazon Lex returns in the response can be either text or 3427 // speech based on the responseContentType value. 3428 // 3429 // * If the value is text/plain;charset=utf-8, Amazon Lex returns text in 3430 // the response. 3431 // 3432 // * If the value begins with audio/, Amazon Lex returns speech in the response. 3433 // Amazon Lex uses Amazon Polly to generate the speech using the configuration 3434 // that you specified in the requestContentType parameter. For example, if 3435 // you specify audio/mpeg as the value, Amazon Lex returns speech in the 3436 // MPEG format. 3437 // 3438 // * If the value is audio/pcm, the speech returned is audio/pcm at 16 KHz 3439 // in 16-bit, little-endian format. 3440 // 3441 // * The following are the accepted values: audio/mpeg audio/ogg audio/pcm 3442 // (16 KHz) audio/* (defaults to mpeg) text/plain; charset=utf-8 3443 ResponseContentType *string `location:"header" locationName:"Response-Content-Type" min:"1" type:"string"` 3444 3445 // The identifier of the session in use. 3446 // 3447 // SessionId is a required field 3448 SessionId *string `location:"uri" locationName:"sessionId" min:"2" type:"string" required:"true"` 3449 3450 // Sets the state of the session with the user. You can use this to set the 3451 // current intent, attributes, context, and dialog action. Use the dialog action 3452 // to determine the next step that Amazon Lex should use in the conversation 3453 // with the user. 3454 SessionState *string `location:"header" locationName:"x-amz-lex-session-state" type:"string" sensitive:"true"` 3455} 3456 3457// String returns the string representation 3458func (s RecognizeUtteranceInput) String() string { 3459 return awsutil.Prettify(s) 3460} 3461 3462// GoString returns the string representation 3463func (s RecognizeUtteranceInput) GoString() string { 3464 return s.String() 3465} 3466 3467// Validate inspects the fields of the type to determine if they are valid. 3468func (s *RecognizeUtteranceInput) Validate() error { 3469 invalidParams := request.ErrInvalidParams{Context: "RecognizeUtteranceInput"} 3470 if s.BotAliasId == nil { 3471 invalidParams.Add(request.NewErrParamRequired("BotAliasId")) 3472 } 3473 if s.BotAliasId != nil && len(*s.BotAliasId) < 1 { 3474 invalidParams.Add(request.NewErrParamMinLen("BotAliasId", 1)) 3475 } 3476 if s.BotId == nil { 3477 invalidParams.Add(request.NewErrParamRequired("BotId")) 3478 } 3479 if s.BotId != nil && len(*s.BotId) < 10 { 3480 invalidParams.Add(request.NewErrParamMinLen("BotId", 10)) 3481 } 3482 if s.LocaleId == nil { 3483 invalidParams.Add(request.NewErrParamRequired("LocaleId")) 3484 } 3485 if s.LocaleId != nil && len(*s.LocaleId) < 1 { 3486 invalidParams.Add(request.NewErrParamMinLen("LocaleId", 1)) 3487 } 3488 if s.RequestContentType == nil { 3489 invalidParams.Add(request.NewErrParamRequired("RequestContentType")) 3490 } 3491 if s.RequestContentType != nil && len(*s.RequestContentType) < 1 { 3492 invalidParams.Add(request.NewErrParamMinLen("RequestContentType", 1)) 3493 } 3494 if s.ResponseContentType != nil && len(*s.ResponseContentType) < 1 { 3495 invalidParams.Add(request.NewErrParamMinLen("ResponseContentType", 1)) 3496 } 3497 if s.SessionId == nil { 3498 invalidParams.Add(request.NewErrParamRequired("SessionId")) 3499 } 3500 if s.SessionId != nil && len(*s.SessionId) < 2 { 3501 invalidParams.Add(request.NewErrParamMinLen("SessionId", 2)) 3502 } 3503 3504 if invalidParams.Len() > 0 { 3505 return invalidParams 3506 } 3507 return nil 3508} 3509 3510// SetBotAliasId sets the BotAliasId field's value. 3511func (s *RecognizeUtteranceInput) SetBotAliasId(v string) *RecognizeUtteranceInput { 3512 s.BotAliasId = &v 3513 return s 3514} 3515 3516// SetBotId sets the BotId field's value. 3517func (s *RecognizeUtteranceInput) SetBotId(v string) *RecognizeUtteranceInput { 3518 s.BotId = &v 3519 return s 3520} 3521 3522// SetInputStream sets the InputStream field's value. 3523func (s *RecognizeUtteranceInput) SetInputStream(v io.ReadSeeker) *RecognizeUtteranceInput { 3524 s.InputStream = v 3525 return s 3526} 3527 3528// SetLocaleId sets the LocaleId field's value. 3529func (s *RecognizeUtteranceInput) SetLocaleId(v string) *RecognizeUtteranceInput { 3530 s.LocaleId = &v 3531 return s 3532} 3533 3534// SetRequestAttributes sets the RequestAttributes field's value. 3535func (s *RecognizeUtteranceInput) SetRequestAttributes(v string) *RecognizeUtteranceInput { 3536 s.RequestAttributes = &v 3537 return s 3538} 3539 3540// SetRequestContentType sets the RequestContentType field's value. 3541func (s *RecognizeUtteranceInput) SetRequestContentType(v string) *RecognizeUtteranceInput { 3542 s.RequestContentType = &v 3543 return s 3544} 3545 3546// SetResponseContentType sets the ResponseContentType field's value. 3547func (s *RecognizeUtteranceInput) SetResponseContentType(v string) *RecognizeUtteranceInput { 3548 s.ResponseContentType = &v 3549 return s 3550} 3551 3552// SetSessionId sets the SessionId field's value. 3553func (s *RecognizeUtteranceInput) SetSessionId(v string) *RecognizeUtteranceInput { 3554 s.SessionId = &v 3555 return s 3556} 3557 3558// SetSessionState sets the SessionState field's value. 3559func (s *RecognizeUtteranceInput) SetSessionState(v string) *RecognizeUtteranceInput { 3560 s.SessionState = &v 3561 return s 3562} 3563 3564type RecognizeUtteranceOutput struct { 3565 _ struct{} `type:"structure" payload:"AudioStream"` 3566 3567 // The prompt or statement to send to the user. This is based on the bot configuration 3568 // and context. For example, if Amazon Lex did not understand the user intent, 3569 // it sends the clarificationPrompt configured for the bot. If the intent requires 3570 // confirmation before taking the fulfillment action, it sends the confirmationPrompt. 3571 // Another example: Suppose that the Lambda function successfully fulfilled 3572 // the intent, and sent a message to convey to the user. Then Amazon Lex sends 3573 // that message in the response. 3574 AudioStream io.ReadCloser `locationName:"audioStream" type:"blob"` 3575 3576 // Content type as specified in the responseContentType in the request. 3577 ContentType *string `location:"header" locationName:"Content-Type" min:"1" type:"string"` 3578 3579 // Indicates whether the input mode to the operation was text or speech. 3580 InputMode *string `location:"header" locationName:"x-amz-lex-input-mode" min:"1" type:"string"` 3581 3582 // The text used to process the request. 3583 // 3584 // If the input was an audio stream, the inputTranscript field contains the 3585 // text extracted from the audio stream. This is the text that is actually processed 3586 // to recognize intents and slot values. You can use this information to determine 3587 // if Amazon Lex is correctly processing the audio that you send. 3588 InputTranscript *string `location:"header" locationName:"x-amz-lex-input-transcript" min:"1" type:"string"` 3589 3590 // A list of intents that Amazon Lex determined might satisfy the user's utterance. 3591 // 3592 // Each interpretation includes the intent, a score that indicates how confident 3593 // Amazon Lex is that the interpretation is the correct one, and an optional 3594 // sentiment response that indicates the sentiment expressed in the utterance. 3595 Interpretations *string `location:"header" locationName:"x-amz-lex-interpretations" min:"1" type:"string"` 3596 3597 // A list of messages that were last sent to the user. The messages are ordered 3598 // based on the order that you returned the messages from your Lambda function 3599 // or the order that the messages are defined in the bot. 3600 Messages *string `location:"header" locationName:"x-amz-lex-messages" min:"1" type:"string"` 3601 3602 // The attributes sent in the request. 3603 RequestAttributes *string `location:"header" locationName:"x-amz-lex-request-attributes" min:"1" type:"string"` 3604 3605 // The identifier of the session in use. 3606 SessionId *string `location:"header" locationName:"x-amz-lex-session-id" min:"2" type:"string"` 3607 3608 // Represents the current state of the dialog between the user and the bot. 3609 // 3610 // Use this to determine the progress of the conversation and what the next 3611 // action might be. 3612 SessionState *string `location:"header" locationName:"x-amz-lex-session-state" min:"1" type:"string"` 3613} 3614 3615// String returns the string representation 3616func (s RecognizeUtteranceOutput) String() string { 3617 return awsutil.Prettify(s) 3618} 3619 3620// GoString returns the string representation 3621func (s RecognizeUtteranceOutput) GoString() string { 3622 return s.String() 3623} 3624 3625// SetAudioStream sets the AudioStream field's value. 3626func (s *RecognizeUtteranceOutput) SetAudioStream(v io.ReadCloser) *RecognizeUtteranceOutput { 3627 s.AudioStream = v 3628 return s 3629} 3630 3631// SetContentType sets the ContentType field's value. 3632func (s *RecognizeUtteranceOutput) SetContentType(v string) *RecognizeUtteranceOutput { 3633 s.ContentType = &v 3634 return s 3635} 3636 3637// SetInputMode sets the InputMode field's value. 3638func (s *RecognizeUtteranceOutput) SetInputMode(v string) *RecognizeUtteranceOutput { 3639 s.InputMode = &v 3640 return s 3641} 3642 3643// SetInputTranscript sets the InputTranscript field's value. 3644func (s *RecognizeUtteranceOutput) SetInputTranscript(v string) *RecognizeUtteranceOutput { 3645 s.InputTranscript = &v 3646 return s 3647} 3648 3649// SetInterpretations sets the Interpretations field's value. 3650func (s *RecognizeUtteranceOutput) SetInterpretations(v string) *RecognizeUtteranceOutput { 3651 s.Interpretations = &v 3652 return s 3653} 3654 3655// SetMessages sets the Messages field's value. 3656func (s *RecognizeUtteranceOutput) SetMessages(v string) *RecognizeUtteranceOutput { 3657 s.Messages = &v 3658 return s 3659} 3660 3661// SetRequestAttributes sets the RequestAttributes field's value. 3662func (s *RecognizeUtteranceOutput) SetRequestAttributes(v string) *RecognizeUtteranceOutput { 3663 s.RequestAttributes = &v 3664 return s 3665} 3666 3667// SetSessionId sets the SessionId field's value. 3668func (s *RecognizeUtteranceOutput) SetSessionId(v string) *RecognizeUtteranceOutput { 3669 s.SessionId = &v 3670 return s 3671} 3672 3673// SetSessionState sets the SessionState field's value. 3674func (s *RecognizeUtteranceOutput) SetSessionState(v string) *RecognizeUtteranceOutput { 3675 s.SessionState = &v 3676 return s 3677} 3678 3679type ResourceNotFoundException struct { 3680 _ struct{} `type:"structure"` 3681 RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` 3682 3683 Message_ *string `locationName:"message" type:"string"` 3684} 3685 3686// String returns the string representation 3687func (s ResourceNotFoundException) String() string { 3688 return awsutil.Prettify(s) 3689} 3690 3691// GoString returns the string representation 3692func (s ResourceNotFoundException) GoString() string { 3693 return s.String() 3694} 3695 3696// The ResourceNotFoundException is and event in the StartConversationResponseEventStream group of events. 3697func (s *ResourceNotFoundException) eventStartConversationResponseEventStream() {} 3698 3699// UnmarshalEvent unmarshals the EventStream Message into the ResourceNotFoundException value. 3700// This method is only used internally within the SDK's EventStream handling. 3701func (s *ResourceNotFoundException) UnmarshalEvent( 3702 payloadUnmarshaler protocol.PayloadUnmarshaler, 3703 msg eventstream.Message, 3704) error { 3705 if err := payloadUnmarshaler.UnmarshalPayload( 3706 bytes.NewReader(msg.Payload), s, 3707 ); err != nil { 3708 return err 3709 } 3710 return nil 3711} 3712 3713// MarshalEvent marshals the type into an stream event value. This method 3714// should only used internally within the SDK's EventStream handling. 3715func (s *ResourceNotFoundException) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { 3716 msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.ExceptionMessageType)) 3717 var buf bytes.Buffer 3718 if err = pm.MarshalPayload(&buf, s); err != nil { 3719 return eventstream.Message{}, err 3720 } 3721 msg.Payload = buf.Bytes() 3722 return msg, err 3723} 3724 3725func newErrorResourceNotFoundException(v protocol.ResponseMetadata) error { 3726 return &ResourceNotFoundException{ 3727 RespMetadata: v, 3728 } 3729} 3730 3731// Code returns the exception type name. 3732func (s *ResourceNotFoundException) Code() string { 3733 return "ResourceNotFoundException" 3734} 3735 3736// Message returns the exception's message. 3737func (s *ResourceNotFoundException) Message() string { 3738 if s.Message_ != nil { 3739 return *s.Message_ 3740 } 3741 return "" 3742} 3743 3744// OrigErr always returns nil, satisfies awserr.Error interface. 3745func (s *ResourceNotFoundException) OrigErr() error { 3746 return nil 3747} 3748 3749func (s *ResourceNotFoundException) Error() string { 3750 return fmt.Sprintf("%s: %s", s.Code(), s.Message()) 3751} 3752 3753// Status code returns the HTTP status code for the request's response error. 3754func (s *ResourceNotFoundException) StatusCode() int { 3755 return s.RespMetadata.StatusCode 3756} 3757 3758// RequestID returns the service's response RequestID for request. 3759func (s *ResourceNotFoundException) RequestID() string { 3760 return s.RespMetadata.RequestID 3761} 3762 3763// Provides information about the sentiment expressed in a user's response in 3764// a conversation. Sentiments are determined using Amazon Comprehend. Sentiments 3765// are only returned if they are enabled for the bot. 3766// 3767// For more information, see Determine Sentiment (https://docs.aws.amazon.com/comprehend/latest/dg/how-sentiment.html) 3768// in the Amazon Comprehend developer guide. 3769type SentimentResponse struct { 3770 _ struct{} `type:"structure"` 3771 3772 // The overall sentiment expressed in the user's response. This is the sentiment 3773 // most likely expressed by the user based on the analysis by Amazon Comprehend. 3774 Sentiment *string `locationName:"sentiment" type:"string" enum:"SentimentType"` 3775 3776 // The individual sentiment responses for the utterance. 3777 SentimentScore *SentimentScore `locationName:"sentimentScore" type:"structure"` 3778} 3779 3780// String returns the string representation 3781func (s SentimentResponse) String() string { 3782 return awsutil.Prettify(s) 3783} 3784 3785// GoString returns the string representation 3786func (s SentimentResponse) GoString() string { 3787 return s.String() 3788} 3789 3790// SetSentiment sets the Sentiment field's value. 3791func (s *SentimentResponse) SetSentiment(v string) *SentimentResponse { 3792 s.Sentiment = &v 3793 return s 3794} 3795 3796// SetSentimentScore sets the SentimentScore field's value. 3797func (s *SentimentResponse) SetSentimentScore(v *SentimentScore) *SentimentResponse { 3798 s.SentimentScore = v 3799 return s 3800} 3801 3802// The individual sentiment responses for the utterance. 3803type SentimentScore struct { 3804 _ struct{} `type:"structure"` 3805 3806 // The level of confidence that Amazon Comprehend has in the accuracy of its 3807 // detection of the MIXED sentiment. 3808 Mixed *float64 `locationName:"mixed" type:"double"` 3809 3810 // The level of confidence that Amazon Comprehend has in the accuracy of its 3811 // detection of the NEGATIVE sentiment. 3812 Negative *float64 `locationName:"negative" type:"double"` 3813 3814 // The level of confidence that Amazon Comprehend has in the accuracy of its 3815 // detection of the NEUTRAL sentiment. 3816 Neutral *float64 `locationName:"neutral" type:"double"` 3817 3818 // The level of confidence that Amazon Comprehend has in the accuracy of its 3819 // detection of the POSITIVE sentiment. 3820 Positive *float64 `locationName:"positive" type:"double"` 3821} 3822 3823// String returns the string representation 3824func (s SentimentScore) String() string { 3825 return awsutil.Prettify(s) 3826} 3827 3828// GoString returns the string representation 3829func (s SentimentScore) GoString() string { 3830 return s.String() 3831} 3832 3833// SetMixed sets the Mixed field's value. 3834func (s *SentimentScore) SetMixed(v float64) *SentimentScore { 3835 s.Mixed = &v 3836 return s 3837} 3838 3839// SetNegative sets the Negative field's value. 3840func (s *SentimentScore) SetNegative(v float64) *SentimentScore { 3841 s.Negative = &v 3842 return s 3843} 3844 3845// SetNeutral sets the Neutral field's value. 3846func (s *SentimentScore) SetNeutral(v float64) *SentimentScore { 3847 s.Neutral = &v 3848 return s 3849} 3850 3851// SetPositive sets the Positive field's value. 3852func (s *SentimentScore) SetPositive(v float64) *SentimentScore { 3853 s.Positive = &v 3854 return s 3855} 3856 3857// The state of the user's session with Amazon Lex. 3858type SessionState struct { 3859 _ struct{} `type:"structure"` 3860 3861 // One or more contexts that indicate to Amazon Lex the context of a request. 3862 // When a context is active, Amazon Lex considers intents with the matching 3863 // context as a trigger as the next intent in a session. 3864 ActiveContexts []*ActiveContext `locationName:"activeContexts" type:"list"` 3865 3866 // The next step that Amazon Lex should take in the conversation with a user. 3867 DialogAction *DialogAction `locationName:"dialogAction" type:"structure"` 3868 3869 // The active intent that Amazon Lex is processing. 3870 Intent *Intent `locationName:"intent" type:"structure"` 3871 3872 OriginatingRequestId *string `locationName:"originatingRequestId" min:"1" type:"string"` 3873 3874 // Map of key/value pairs representing session-specific context information. 3875 // It contains application information passed between Amazon Lex and a client 3876 // application. 3877 SessionAttributes map[string]*string `locationName:"sessionAttributes" type:"map"` 3878} 3879 3880// String returns the string representation 3881func (s SessionState) String() string { 3882 return awsutil.Prettify(s) 3883} 3884 3885// GoString returns the string representation 3886func (s SessionState) GoString() string { 3887 return s.String() 3888} 3889 3890// Validate inspects the fields of the type to determine if they are valid. 3891func (s *SessionState) Validate() error { 3892 invalidParams := request.ErrInvalidParams{Context: "SessionState"} 3893 if s.OriginatingRequestId != nil && len(*s.OriginatingRequestId) < 1 { 3894 invalidParams.Add(request.NewErrParamMinLen("OriginatingRequestId", 1)) 3895 } 3896 if s.ActiveContexts != nil { 3897 for i, v := range s.ActiveContexts { 3898 if v == nil { 3899 continue 3900 } 3901 if err := v.Validate(); err != nil { 3902 invalidParams.AddNested(fmt.Sprintf("%s[%v]", "ActiveContexts", i), err.(request.ErrInvalidParams)) 3903 } 3904 } 3905 } 3906 if s.DialogAction != nil { 3907 if err := s.DialogAction.Validate(); err != nil { 3908 invalidParams.AddNested("DialogAction", err.(request.ErrInvalidParams)) 3909 } 3910 } 3911 if s.Intent != nil { 3912 if err := s.Intent.Validate(); err != nil { 3913 invalidParams.AddNested("Intent", err.(request.ErrInvalidParams)) 3914 } 3915 } 3916 3917 if invalidParams.Len() > 0 { 3918 return invalidParams 3919 } 3920 return nil 3921} 3922 3923// SetActiveContexts sets the ActiveContexts field's value. 3924func (s *SessionState) SetActiveContexts(v []*ActiveContext) *SessionState { 3925 s.ActiveContexts = v 3926 return s 3927} 3928 3929// SetDialogAction sets the DialogAction field's value. 3930func (s *SessionState) SetDialogAction(v *DialogAction) *SessionState { 3931 s.DialogAction = v 3932 return s 3933} 3934 3935// SetIntent sets the Intent field's value. 3936func (s *SessionState) SetIntent(v *Intent) *SessionState { 3937 s.Intent = v 3938 return s 3939} 3940 3941// SetOriginatingRequestId sets the OriginatingRequestId field's value. 3942func (s *SessionState) SetOriginatingRequestId(v string) *SessionState { 3943 s.OriginatingRequestId = &v 3944 return s 3945} 3946 3947// SetSessionAttributes sets the SessionAttributes field's value. 3948func (s *SessionState) SetSessionAttributes(v map[string]*string) *SessionState { 3949 s.SessionAttributes = v 3950 return s 3951} 3952 3953// A value that Amazon Lex uses to fulfill an intent. 3954type Slot struct { 3955 _ struct{} `type:"structure"` 3956 3957 // The current value of the slot. 3958 Value *Value `locationName:"value" type:"structure"` 3959} 3960 3961// String returns the string representation 3962func (s Slot) String() string { 3963 return awsutil.Prettify(s) 3964} 3965 3966// GoString returns the string representation 3967func (s Slot) GoString() string { 3968 return s.String() 3969} 3970 3971// Validate inspects the fields of the type to determine if they are valid. 3972func (s *Slot) Validate() error { 3973 invalidParams := request.ErrInvalidParams{Context: "Slot"} 3974 if s.Value != nil { 3975 if err := s.Value.Validate(); err != nil { 3976 invalidParams.AddNested("Value", err.(request.ErrInvalidParams)) 3977 } 3978 } 3979 3980 if invalidParams.Len() > 0 { 3981 return invalidParams 3982 } 3983 return nil 3984} 3985 3986// SetValue sets the Value field's value. 3987func (s *Slot) SetValue(v *Value) *Slot { 3988 s.Value = v 3989 return s 3990} 3991 3992type StartConversationInput struct { 3993 _ struct{} `type:"structure" payload:"RequestEventStream"` 3994 3995 // The alias identifier in use for the bot that processes the request. 3996 // 3997 // BotAliasId is a required field 3998 BotAliasId *string `location:"uri" locationName:"botAliasId" type:"string" required:"true"` 3999 4000 // The identifier of the bot to process the request. 4001 // 4002 // BotId is a required field 4003 BotId *string `location:"uri" locationName:"botId" min:"10" type:"string" required:"true"` 4004 4005 // The conversation type that you are using the Amazon Lex. If the conversation 4006 // mode is AUDIO you can send both audio and DTMF information. If the mode is 4007 // TEXT you can only send text. 4008 ConversationMode *string `location:"header" locationName:"x-amz-lex-conversation-mode" type:"string" enum:"ConversationMode"` 4009 4010 // The locale where the session is in use. 4011 // 4012 // LocaleId is a required field 4013 LocaleId *string `location:"uri" locationName:"localeId" min:"1" type:"string" required:"true"` 4014 4015 // The identifier of the user session that is having the conversation. 4016 // 4017 // SessionId is a required field 4018 SessionId *string `location:"uri" locationName:"sessionId" min:"2" type:"string" required:"true"` 4019} 4020 4021// String returns the string representation 4022func (s StartConversationInput) String() string { 4023 return awsutil.Prettify(s) 4024} 4025 4026// GoString returns the string representation 4027func (s StartConversationInput) GoString() string { 4028 return s.String() 4029} 4030 4031// Validate inspects the fields of the type to determine if they are valid. 4032func (s *StartConversationInput) Validate() error { 4033 invalidParams := request.ErrInvalidParams{Context: "StartConversationInput"} 4034 if s.BotAliasId == nil { 4035 invalidParams.Add(request.NewErrParamRequired("BotAliasId")) 4036 } 4037 if s.BotAliasId != nil && len(*s.BotAliasId) < 1 { 4038 invalidParams.Add(request.NewErrParamMinLen("BotAliasId", 1)) 4039 } 4040 if s.BotId == nil { 4041 invalidParams.Add(request.NewErrParamRequired("BotId")) 4042 } 4043 if s.BotId != nil && len(*s.BotId) < 10 { 4044 invalidParams.Add(request.NewErrParamMinLen("BotId", 10)) 4045 } 4046 if s.LocaleId == nil { 4047 invalidParams.Add(request.NewErrParamRequired("LocaleId")) 4048 } 4049 if s.LocaleId != nil && len(*s.LocaleId) < 1 { 4050 invalidParams.Add(request.NewErrParamMinLen("LocaleId", 1)) 4051 } 4052 if s.SessionId == nil { 4053 invalidParams.Add(request.NewErrParamRequired("SessionId")) 4054 } 4055 if s.SessionId != nil && len(*s.SessionId) < 2 { 4056 invalidParams.Add(request.NewErrParamMinLen("SessionId", 2)) 4057 } 4058 4059 if invalidParams.Len() > 0 { 4060 return invalidParams 4061 } 4062 return nil 4063} 4064 4065// SetBotAliasId sets the BotAliasId field's value. 4066func (s *StartConversationInput) SetBotAliasId(v string) *StartConversationInput { 4067 s.BotAliasId = &v 4068 return s 4069} 4070 4071// SetBotId sets the BotId field's value. 4072func (s *StartConversationInput) SetBotId(v string) *StartConversationInput { 4073 s.BotId = &v 4074 return s 4075} 4076 4077// SetConversationMode sets the ConversationMode field's value. 4078func (s *StartConversationInput) SetConversationMode(v string) *StartConversationInput { 4079 s.ConversationMode = &v 4080 return s 4081} 4082 4083// SetLocaleId sets the LocaleId field's value. 4084func (s *StartConversationInput) SetLocaleId(v string) *StartConversationInput { 4085 s.LocaleId = &v 4086 return s 4087} 4088 4089// SetSessionId sets the SessionId field's value. 4090func (s *StartConversationInput) SetSessionId(v string) *StartConversationInput { 4091 s.SessionId = &v 4092 return s 4093} 4094 4095type StartConversationOutput struct { 4096 _ struct{} `type:"structure" payload:"ResponseEventStream"` 4097 4098 eventStream *StartConversationEventStream 4099} 4100 4101// String returns the string representation 4102func (s StartConversationOutput) String() string { 4103 return awsutil.Prettify(s) 4104} 4105 4106// GoString returns the string representation 4107func (s StartConversationOutput) GoString() string { 4108 return s.String() 4109} 4110 4111// GetStream returns the type to interact with the event stream. 4112func (s *StartConversationOutput) GetStream() *StartConversationEventStream { 4113 return s.eventStream 4114} 4115 4116// StartConversationRequestEventStreamEvent groups together all EventStream 4117// events writes for StartConversationRequestEventStream. 4118// 4119// These events are: 4120// 4121// * AudioInputEvent 4122// * ConfigurationEvent 4123// * DTMFInputEvent 4124// * DisconnectionEvent 4125// * PlaybackCompletionEvent 4126// * TextInputEvent 4127type StartConversationRequestEventStreamEvent interface { 4128 eventStartConversationRequestEventStream() 4129 eventstreamapi.Marshaler 4130 eventstreamapi.Unmarshaler 4131} 4132 4133// StartConversationRequestEventStreamWriter provides the interface for writing events to the stream. 4134// The default implementation for this interface will be StartConversationRequestEventStream. 4135// 4136// The writer's Close method must allow multiple concurrent calls. 4137// 4138// These events are: 4139// 4140// * AudioInputEvent 4141// * ConfigurationEvent 4142// * DTMFInputEvent 4143// * DisconnectionEvent 4144// * PlaybackCompletionEvent 4145// * TextInputEvent 4146type StartConversationRequestEventStreamWriter interface { 4147 // Sends writes events to the stream blocking until the event has been 4148 // written. An error is returned if the write fails. 4149 Send(aws.Context, StartConversationRequestEventStreamEvent) error 4150 4151 // Close will stop the writer writing to the event stream. 4152 Close() error 4153 4154 // Returns any error that has occurred while writing to the event stream. 4155 Err() error 4156} 4157 4158type writeStartConversationRequestEventStream struct { 4159 *eventstreamapi.StreamWriter 4160} 4161 4162func (w *writeStartConversationRequestEventStream) Send(ctx aws.Context, event StartConversationRequestEventStreamEvent) error { 4163 return w.StreamWriter.Send(ctx, event) 4164} 4165 4166func eventTypeForStartConversationRequestEventStreamEvent(event eventstreamapi.Marshaler) (string, error) { 4167 switch event.(type) { 4168 case *AudioInputEvent: 4169 return "AudioInputEvent", nil 4170 case *ConfigurationEvent: 4171 return "ConfigurationEvent", nil 4172 case *DTMFInputEvent: 4173 return "DTMFInputEvent", nil 4174 case *DisconnectionEvent: 4175 return "DisconnectionEvent", nil 4176 case *PlaybackCompletionEvent: 4177 return "PlaybackCompletionEvent", nil 4178 case *TextInputEvent: 4179 return "TextInputEvent", nil 4180 default: 4181 return "", awserr.New( 4182 request.ErrCodeSerialization, 4183 fmt.Sprintf("unknown event type, %T, for StartConversationRequestEventStream", event), 4184 nil, 4185 ) 4186 } 4187} 4188 4189// StartConversationResponseEventStreamEvent groups together all EventStream 4190// events writes for StartConversationResponseEventStream. 4191// 4192// These events are: 4193// 4194// * AudioResponseEvent 4195// * HeartbeatEvent 4196// * IntentResultEvent 4197// * PlaybackInterruptionEvent 4198// * TextResponseEvent 4199// * TranscriptEvent 4200type StartConversationResponseEventStreamEvent interface { 4201 eventStartConversationResponseEventStream() 4202 eventstreamapi.Marshaler 4203 eventstreamapi.Unmarshaler 4204} 4205 4206// StartConversationResponseEventStreamReader provides the interface for reading to the stream. The 4207// default implementation for this interface will be StartConversationResponseEventStream. 4208// 4209// The reader's Close method must allow multiple concurrent calls. 4210// 4211// These events are: 4212// 4213// * AudioResponseEvent 4214// * HeartbeatEvent 4215// * IntentResultEvent 4216// * PlaybackInterruptionEvent 4217// * TextResponseEvent 4218// * TranscriptEvent 4219// * StartConversationResponseEventStreamUnknownEvent 4220type StartConversationResponseEventStreamReader interface { 4221 // Returns a channel of events as they are read from the event stream. 4222 Events() <-chan StartConversationResponseEventStreamEvent 4223 4224 // Close will stop the reader reading events from the stream. 4225 Close() error 4226 4227 // Returns any error that has occurred while reading from the event stream. 4228 Err() error 4229} 4230 4231type readStartConversationResponseEventStream struct { 4232 eventReader *eventstreamapi.EventReader 4233 stream chan StartConversationResponseEventStreamEvent 4234 err *eventstreamapi.OnceError 4235 4236 done chan struct{} 4237 closeOnce sync.Once 4238} 4239 4240func newReadStartConversationResponseEventStream(eventReader *eventstreamapi.EventReader) *readStartConversationResponseEventStream { 4241 r := &readStartConversationResponseEventStream{ 4242 eventReader: eventReader, 4243 stream: make(chan StartConversationResponseEventStreamEvent), 4244 done: make(chan struct{}), 4245 err: eventstreamapi.NewOnceError(), 4246 } 4247 go r.readEventStream() 4248 4249 return r 4250} 4251 4252// Close will close the underlying event stream reader. 4253func (r *readStartConversationResponseEventStream) Close() error { 4254 r.closeOnce.Do(r.safeClose) 4255 return r.Err() 4256} 4257 4258func (r *readStartConversationResponseEventStream) ErrorSet() <-chan struct{} { 4259 return r.err.ErrorSet() 4260} 4261 4262func (r *readStartConversationResponseEventStream) Closed() <-chan struct{} { 4263 return r.done 4264} 4265 4266func (r *readStartConversationResponseEventStream) safeClose() { 4267 close(r.done) 4268} 4269 4270func (r *readStartConversationResponseEventStream) Err() error { 4271 return r.err.Err() 4272} 4273 4274func (r *readStartConversationResponseEventStream) Events() <-chan StartConversationResponseEventStreamEvent { 4275 return r.stream 4276} 4277 4278func (r *readStartConversationResponseEventStream) readEventStream() { 4279 defer r.Close() 4280 defer close(r.stream) 4281 4282 for { 4283 event, err := r.eventReader.ReadEvent() 4284 if err != nil { 4285 if err == io.EOF { 4286 return 4287 } 4288 select { 4289 case <-r.done: 4290 // If closed already ignore the error 4291 return 4292 default: 4293 } 4294 if _, ok := err.(*eventstreamapi.UnknownMessageTypeError); ok { 4295 continue 4296 } 4297 r.err.SetError(err) 4298 return 4299 } 4300 4301 select { 4302 case r.stream <- event.(StartConversationResponseEventStreamEvent): 4303 case <-r.done: 4304 return 4305 } 4306 } 4307} 4308 4309type unmarshalerForStartConversationResponseEventStreamEvent struct { 4310 metadata protocol.ResponseMetadata 4311} 4312 4313func (u unmarshalerForStartConversationResponseEventStreamEvent) UnmarshalerForEventName(eventType string) (eventstreamapi.Unmarshaler, error) { 4314 switch eventType { 4315 case "AudioResponseEvent": 4316 return &AudioResponseEvent{}, nil 4317 case "HeartbeatEvent": 4318 return &HeartbeatEvent{}, nil 4319 case "IntentResultEvent": 4320 return &IntentResultEvent{}, nil 4321 case "PlaybackInterruptionEvent": 4322 return &PlaybackInterruptionEvent{}, nil 4323 case "TextResponseEvent": 4324 return &TextResponseEvent{}, nil 4325 case "TranscriptEvent": 4326 return &TranscriptEvent{}, nil 4327 case "AccessDeniedException": 4328 return newErrorAccessDeniedException(u.metadata).(eventstreamapi.Unmarshaler), nil 4329 case "BadGatewayException": 4330 return newErrorBadGatewayException(u.metadata).(eventstreamapi.Unmarshaler), nil 4331 case "ConflictException": 4332 return newErrorConflictException(u.metadata).(eventstreamapi.Unmarshaler), nil 4333 case "DependencyFailedException": 4334 return newErrorDependencyFailedException(u.metadata).(eventstreamapi.Unmarshaler), nil 4335 case "InternalServerException": 4336 return newErrorInternalServerException(u.metadata).(eventstreamapi.Unmarshaler), nil 4337 case "ResourceNotFoundException": 4338 return newErrorResourceNotFoundException(u.metadata).(eventstreamapi.Unmarshaler), nil 4339 case "ThrottlingException": 4340 return newErrorThrottlingException(u.metadata).(eventstreamapi.Unmarshaler), nil 4341 case "ValidationException": 4342 return newErrorValidationException(u.metadata).(eventstreamapi.Unmarshaler), nil 4343 default: 4344 return &StartConversationResponseEventStreamUnknownEvent{Type: eventType}, nil 4345 } 4346} 4347 4348// StartConversationResponseEventStreamUnknownEvent provides a failsafe event for the 4349// StartConversationResponseEventStream group of events when an unknown event is received. 4350type StartConversationResponseEventStreamUnknownEvent struct { 4351 Type string 4352 Message eventstream.Message 4353} 4354 4355// The StartConversationResponseEventStreamUnknownEvent is and event in the StartConversationResponseEventStream 4356// group of events. 4357func (s *StartConversationResponseEventStreamUnknownEvent) eventStartConversationResponseEventStream() { 4358} 4359 4360// MarshalEvent marshals the type into an stream event value. This method 4361// should only used internally within the SDK's EventStream handling. 4362func (e *StartConversationResponseEventStreamUnknownEvent) MarshalEvent(pm protocol.PayloadMarshaler) ( 4363 msg eventstream.Message, err error, 4364) { 4365 return e.Message.Clone(), nil 4366} 4367 4368// UnmarshalEvent unmarshals the EventStream Message into the StartConversationResponseEventStream value. 4369// This method is only used internally within the SDK's EventStream handling. 4370func (e *StartConversationResponseEventStreamUnknownEvent) UnmarshalEvent( 4371 payloadUnmarshaler protocol.PayloadUnmarshaler, 4372 msg eventstream.Message, 4373) error { 4374 e.Message = msg.Clone() 4375 return nil 4376} 4377 4378// The event sent from your client application to Amazon Lex with text input 4379// from the user. 4380type TextInputEvent struct { 4381 _ struct{} `type:"structure"` 4382 4383 // A timestamp set by the client of the date and time that the event was sent 4384 // to Amazon Lex. 4385 ClientTimestampMillis *int64 `locationName:"clientTimestampMillis" type:"long"` 4386 4387 // A unique identifier that your application assigns to the event. You can use 4388 // this to identify events in logs. 4389 EventId *string `locationName:"eventId" min:"2" type:"string"` 4390 4391 // The text from the user. Amazon Lex processes this as a complete statement. 4392 // 4393 // Text is a required field 4394 Text *string `locationName:"text" min:"1" type:"string" required:"true" sensitive:"true"` 4395} 4396 4397// String returns the string representation 4398func (s TextInputEvent) String() string { 4399 return awsutil.Prettify(s) 4400} 4401 4402// GoString returns the string representation 4403func (s TextInputEvent) GoString() string { 4404 return s.String() 4405} 4406 4407// SetClientTimestampMillis sets the ClientTimestampMillis field's value. 4408func (s *TextInputEvent) SetClientTimestampMillis(v int64) *TextInputEvent { 4409 s.ClientTimestampMillis = &v 4410 return s 4411} 4412 4413// SetEventId sets the EventId field's value. 4414func (s *TextInputEvent) SetEventId(v string) *TextInputEvent { 4415 s.EventId = &v 4416 return s 4417} 4418 4419// SetText sets the Text field's value. 4420func (s *TextInputEvent) SetText(v string) *TextInputEvent { 4421 s.Text = &v 4422 return s 4423} 4424 4425// The TextInputEvent is and event in the StartConversationRequestEventStream group of events. 4426func (s *TextInputEvent) eventStartConversationRequestEventStream() {} 4427 4428// UnmarshalEvent unmarshals the EventStream Message into the TextInputEvent value. 4429// This method is only used internally within the SDK's EventStream handling. 4430func (s *TextInputEvent) UnmarshalEvent( 4431 payloadUnmarshaler protocol.PayloadUnmarshaler, 4432 msg eventstream.Message, 4433) error { 4434 if err := payloadUnmarshaler.UnmarshalPayload( 4435 bytes.NewReader(msg.Payload), s, 4436 ); err != nil { 4437 return err 4438 } 4439 return nil 4440} 4441 4442// MarshalEvent marshals the type into an stream event value. This method 4443// should only used internally within the SDK's EventStream handling. 4444func (s *TextInputEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { 4445 msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType)) 4446 var buf bytes.Buffer 4447 if err = pm.MarshalPayload(&buf, s); err != nil { 4448 return eventstream.Message{}, err 4449 } 4450 msg.Payload = buf.Bytes() 4451 return msg, err 4452} 4453 4454// The event sent from Amazon Lex to your application with text to present to 4455// the user. 4456type TextResponseEvent struct { 4457 _ struct{} `type:"structure"` 4458 4459 // A unique identifier of the event sent by Amazon Lex. The identifier is in 4460 // the form RESPONSE-N, where N is a number starting with one and incremented 4461 // for each event sent by Amazon Lex in the current session. 4462 EventId *string `locationName:"eventId" min:"2" type:"string"` 4463 4464 // A list of messages to send to the user. Messages are ordered based on the 4465 // order that you returned the messages from your Lambda function or the order 4466 // that the messages are defined in the bot. 4467 Messages []*Message `locationName:"messages" type:"list"` 4468} 4469 4470// String returns the string representation 4471func (s TextResponseEvent) String() string { 4472 return awsutil.Prettify(s) 4473} 4474 4475// GoString returns the string representation 4476func (s TextResponseEvent) GoString() string { 4477 return s.String() 4478} 4479 4480// SetEventId sets the EventId field's value. 4481func (s *TextResponseEvent) SetEventId(v string) *TextResponseEvent { 4482 s.EventId = &v 4483 return s 4484} 4485 4486// SetMessages sets the Messages field's value. 4487func (s *TextResponseEvent) SetMessages(v []*Message) *TextResponseEvent { 4488 s.Messages = v 4489 return s 4490} 4491 4492// The TextResponseEvent is and event in the StartConversationResponseEventStream group of events. 4493func (s *TextResponseEvent) eventStartConversationResponseEventStream() {} 4494 4495// UnmarshalEvent unmarshals the EventStream Message into the TextResponseEvent value. 4496// This method is only used internally within the SDK's EventStream handling. 4497func (s *TextResponseEvent) UnmarshalEvent( 4498 payloadUnmarshaler protocol.PayloadUnmarshaler, 4499 msg eventstream.Message, 4500) error { 4501 if err := payloadUnmarshaler.UnmarshalPayload( 4502 bytes.NewReader(msg.Payload), s, 4503 ); err != nil { 4504 return err 4505 } 4506 return nil 4507} 4508 4509// MarshalEvent marshals the type into an stream event value. This method 4510// should only used internally within the SDK's EventStream handling. 4511func (s *TextResponseEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { 4512 msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType)) 4513 var buf bytes.Buffer 4514 if err = pm.MarshalPayload(&buf, s); err != nil { 4515 return eventstream.Message{}, err 4516 } 4517 msg.Payload = buf.Bytes() 4518 return msg, err 4519} 4520 4521type ThrottlingException struct { 4522 _ struct{} `type:"structure"` 4523 RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` 4524 4525 Message_ *string `locationName:"message" type:"string"` 4526} 4527 4528// String returns the string representation 4529func (s ThrottlingException) String() string { 4530 return awsutil.Prettify(s) 4531} 4532 4533// GoString returns the string representation 4534func (s ThrottlingException) GoString() string { 4535 return s.String() 4536} 4537 4538// The ThrottlingException is and event in the StartConversationResponseEventStream group of events. 4539func (s *ThrottlingException) eventStartConversationResponseEventStream() {} 4540 4541// UnmarshalEvent unmarshals the EventStream Message into the ThrottlingException value. 4542// This method is only used internally within the SDK's EventStream handling. 4543func (s *ThrottlingException) UnmarshalEvent( 4544 payloadUnmarshaler protocol.PayloadUnmarshaler, 4545 msg eventstream.Message, 4546) error { 4547 if err := payloadUnmarshaler.UnmarshalPayload( 4548 bytes.NewReader(msg.Payload), s, 4549 ); err != nil { 4550 return err 4551 } 4552 return nil 4553} 4554 4555// MarshalEvent marshals the type into an stream event value. This method 4556// should only used internally within the SDK's EventStream handling. 4557func (s *ThrottlingException) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { 4558 msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.ExceptionMessageType)) 4559 var buf bytes.Buffer 4560 if err = pm.MarshalPayload(&buf, s); err != nil { 4561 return eventstream.Message{}, err 4562 } 4563 msg.Payload = buf.Bytes() 4564 return msg, err 4565} 4566 4567func newErrorThrottlingException(v protocol.ResponseMetadata) error { 4568 return &ThrottlingException{ 4569 RespMetadata: v, 4570 } 4571} 4572 4573// Code returns the exception type name. 4574func (s *ThrottlingException) Code() string { 4575 return "ThrottlingException" 4576} 4577 4578// Message returns the exception's message. 4579func (s *ThrottlingException) Message() string { 4580 if s.Message_ != nil { 4581 return *s.Message_ 4582 } 4583 return "" 4584} 4585 4586// OrigErr always returns nil, satisfies awserr.Error interface. 4587func (s *ThrottlingException) OrigErr() error { 4588 return nil 4589} 4590 4591func (s *ThrottlingException) Error() string { 4592 return fmt.Sprintf("%s: %s", s.Code(), s.Message()) 4593} 4594 4595// Status code returns the HTTP status code for the request's response error. 4596func (s *ThrottlingException) StatusCode() int { 4597 return s.RespMetadata.StatusCode 4598} 4599 4600// RequestID returns the service's response RequestID for request. 4601func (s *ThrottlingException) RequestID() string { 4602 return s.RespMetadata.RequestID 4603} 4604 4605// Event sent from Amazon Lex to your client application that contains a transcript 4606// of voice audio. 4607type TranscriptEvent struct { 4608 _ struct{} `type:"structure"` 4609 4610 // A unique identifier of the event sent by Amazon Lex. The identifier is in 4611 // the form RESPONSE-N, where N is a number starting with one and incremented 4612 // for each event sent by Amazon Lex in the current session. 4613 EventId *string `locationName:"eventId" min:"2" type:"string"` 4614 4615 // The transcript of the voice audio from the user. 4616 Transcript *string `locationName:"transcript" type:"string"` 4617} 4618 4619// String returns the string representation 4620func (s TranscriptEvent) String() string { 4621 return awsutil.Prettify(s) 4622} 4623 4624// GoString returns the string representation 4625func (s TranscriptEvent) GoString() string { 4626 return s.String() 4627} 4628 4629// SetEventId sets the EventId field's value. 4630func (s *TranscriptEvent) SetEventId(v string) *TranscriptEvent { 4631 s.EventId = &v 4632 return s 4633} 4634 4635// SetTranscript sets the Transcript field's value. 4636func (s *TranscriptEvent) SetTranscript(v string) *TranscriptEvent { 4637 s.Transcript = &v 4638 return s 4639} 4640 4641// The TranscriptEvent is and event in the StartConversationResponseEventStream group of events. 4642func (s *TranscriptEvent) eventStartConversationResponseEventStream() {} 4643 4644// UnmarshalEvent unmarshals the EventStream Message into the TranscriptEvent value. 4645// This method is only used internally within the SDK's EventStream handling. 4646func (s *TranscriptEvent) UnmarshalEvent( 4647 payloadUnmarshaler protocol.PayloadUnmarshaler, 4648 msg eventstream.Message, 4649) error { 4650 if err := payloadUnmarshaler.UnmarshalPayload( 4651 bytes.NewReader(msg.Payload), s, 4652 ); err != nil { 4653 return err 4654 } 4655 return nil 4656} 4657 4658// MarshalEvent marshals the type into an stream event value. This method 4659// should only used internally within the SDK's EventStream handling. 4660func (s *TranscriptEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { 4661 msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType)) 4662 var buf bytes.Buffer 4663 if err = pm.MarshalPayload(&buf, s); err != nil { 4664 return eventstream.Message{}, err 4665 } 4666 msg.Payload = buf.Bytes() 4667 return msg, err 4668} 4669 4670type ValidationException struct { 4671 _ struct{} `type:"structure"` 4672 RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` 4673 4674 Message_ *string `locationName:"message" type:"string"` 4675} 4676 4677// String returns the string representation 4678func (s ValidationException) String() string { 4679 return awsutil.Prettify(s) 4680} 4681 4682// GoString returns the string representation 4683func (s ValidationException) GoString() string { 4684 return s.String() 4685} 4686 4687// The ValidationException is and event in the StartConversationResponseEventStream group of events. 4688func (s *ValidationException) eventStartConversationResponseEventStream() {} 4689 4690// UnmarshalEvent unmarshals the EventStream Message into the ValidationException value. 4691// This method is only used internally within the SDK's EventStream handling. 4692func (s *ValidationException) UnmarshalEvent( 4693 payloadUnmarshaler protocol.PayloadUnmarshaler, 4694 msg eventstream.Message, 4695) error { 4696 if err := payloadUnmarshaler.UnmarshalPayload( 4697 bytes.NewReader(msg.Payload), s, 4698 ); err != nil { 4699 return err 4700 } 4701 return nil 4702} 4703 4704// MarshalEvent marshals the type into an stream event value. This method 4705// should only used internally within the SDK's EventStream handling. 4706func (s *ValidationException) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { 4707 msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.ExceptionMessageType)) 4708 var buf bytes.Buffer 4709 if err = pm.MarshalPayload(&buf, s); err != nil { 4710 return eventstream.Message{}, err 4711 } 4712 msg.Payload = buf.Bytes() 4713 return msg, err 4714} 4715 4716func newErrorValidationException(v protocol.ResponseMetadata) error { 4717 return &ValidationException{ 4718 RespMetadata: v, 4719 } 4720} 4721 4722// Code returns the exception type name. 4723func (s *ValidationException) Code() string { 4724 return "ValidationException" 4725} 4726 4727// Message returns the exception's message. 4728func (s *ValidationException) Message() string { 4729 if s.Message_ != nil { 4730 return *s.Message_ 4731 } 4732 return "" 4733} 4734 4735// OrigErr always returns nil, satisfies awserr.Error interface. 4736func (s *ValidationException) OrigErr() error { 4737 return nil 4738} 4739 4740func (s *ValidationException) Error() string { 4741 return fmt.Sprintf("%s: %s", s.Code(), s.Message()) 4742} 4743 4744// Status code returns the HTTP status code for the request's response error. 4745func (s *ValidationException) StatusCode() int { 4746 return s.RespMetadata.StatusCode 4747} 4748 4749// RequestID returns the service's response RequestID for request. 4750func (s *ValidationException) RequestID() string { 4751 return s.RespMetadata.RequestID 4752} 4753 4754// The value of a slot. 4755type Value struct { 4756 _ struct{} `type:"structure"` 4757 4758 // The value that Amazon Lex determines for the slot. The actual value depends 4759 // on the setting of the value selection strategy for the bot. You can choose 4760 // to use the value entered by the user, or you can have Amazon Lex choose the 4761 // first value in the resolvedValues list. 4762 // 4763 // InterpretedValue is a required field 4764 InterpretedValue *string `locationName:"interpretedValue" min:"1" type:"string" required:"true"` 4765 4766 // The text of the utterance from the user that was entered for the slot. 4767 OriginalValue *string `locationName:"originalValue" min:"1" type:"string"` 4768 4769 // A list of additional values that have been recognized for the slot. 4770 ResolvedValues []*string `locationName:"resolvedValues" type:"list"` 4771} 4772 4773// String returns the string representation 4774func (s Value) String() string { 4775 return awsutil.Prettify(s) 4776} 4777 4778// GoString returns the string representation 4779func (s Value) GoString() string { 4780 return s.String() 4781} 4782 4783// Validate inspects the fields of the type to determine if they are valid. 4784func (s *Value) Validate() error { 4785 invalidParams := request.ErrInvalidParams{Context: "Value"} 4786 if s.InterpretedValue == nil { 4787 invalidParams.Add(request.NewErrParamRequired("InterpretedValue")) 4788 } 4789 if s.InterpretedValue != nil && len(*s.InterpretedValue) < 1 { 4790 invalidParams.Add(request.NewErrParamMinLen("InterpretedValue", 1)) 4791 } 4792 if s.OriginalValue != nil && len(*s.OriginalValue) < 1 { 4793 invalidParams.Add(request.NewErrParamMinLen("OriginalValue", 1)) 4794 } 4795 4796 if invalidParams.Len() > 0 { 4797 return invalidParams 4798 } 4799 return nil 4800} 4801 4802// SetInterpretedValue sets the InterpretedValue field's value. 4803func (s *Value) SetInterpretedValue(v string) *Value { 4804 s.InterpretedValue = &v 4805 return s 4806} 4807 4808// SetOriginalValue sets the OriginalValue field's value. 4809func (s *Value) SetOriginalValue(v string) *Value { 4810 s.OriginalValue = &v 4811 return s 4812} 4813 4814// SetResolvedValues sets the ResolvedValues field's value. 4815func (s *Value) SetResolvedValues(v []*string) *Value { 4816 s.ResolvedValues = v 4817 return s 4818} 4819 4820const ( 4821 // ConfirmationStateConfirmed is a ConfirmationState enum value 4822 ConfirmationStateConfirmed = "Confirmed" 4823 4824 // ConfirmationStateDenied is a ConfirmationState enum value 4825 ConfirmationStateDenied = "Denied" 4826 4827 // ConfirmationStateNone is a ConfirmationState enum value 4828 ConfirmationStateNone = "None" 4829) 4830 4831// ConfirmationState_Values returns all elements of the ConfirmationState enum 4832func ConfirmationState_Values() []string { 4833 return []string{ 4834 ConfirmationStateConfirmed, 4835 ConfirmationStateDenied, 4836 ConfirmationStateNone, 4837 } 4838} 4839 4840const ( 4841 // ConversationModeAudio is a ConversationMode enum value 4842 ConversationModeAudio = "AUDIO" 4843 4844 // ConversationModeText is a ConversationMode enum value 4845 ConversationModeText = "TEXT" 4846) 4847 4848// ConversationMode_Values returns all elements of the ConversationMode enum 4849func ConversationMode_Values() []string { 4850 return []string{ 4851 ConversationModeAudio, 4852 ConversationModeText, 4853 } 4854} 4855 4856const ( 4857 // DialogActionTypeClose is a DialogActionType enum value 4858 DialogActionTypeClose = "Close" 4859 4860 // DialogActionTypeConfirmIntent is a DialogActionType enum value 4861 DialogActionTypeConfirmIntent = "ConfirmIntent" 4862 4863 // DialogActionTypeDelegate is a DialogActionType enum value 4864 DialogActionTypeDelegate = "Delegate" 4865 4866 // DialogActionTypeElicitIntent is a DialogActionType enum value 4867 DialogActionTypeElicitIntent = "ElicitIntent" 4868 4869 // DialogActionTypeElicitSlot is a DialogActionType enum value 4870 DialogActionTypeElicitSlot = "ElicitSlot" 4871) 4872 4873// DialogActionType_Values returns all elements of the DialogActionType enum 4874func DialogActionType_Values() []string { 4875 return []string{ 4876 DialogActionTypeClose, 4877 DialogActionTypeConfirmIntent, 4878 DialogActionTypeDelegate, 4879 DialogActionTypeElicitIntent, 4880 DialogActionTypeElicitSlot, 4881 } 4882} 4883 4884const ( 4885 // InputModeText is a InputMode enum value 4886 InputModeText = "Text" 4887 4888 // InputModeSpeech is a InputMode enum value 4889 InputModeSpeech = "Speech" 4890 4891 // InputModeDtmf is a InputMode enum value 4892 InputModeDtmf = "DTMF" 4893) 4894 4895// InputMode_Values returns all elements of the InputMode enum 4896func InputMode_Values() []string { 4897 return []string{ 4898 InputModeText, 4899 InputModeSpeech, 4900 InputModeDtmf, 4901 } 4902} 4903 4904const ( 4905 // IntentStateFailed is a IntentState enum value 4906 IntentStateFailed = "Failed" 4907 4908 // IntentStateFulfilled is a IntentState enum value 4909 IntentStateFulfilled = "Fulfilled" 4910 4911 // IntentStateInProgress is a IntentState enum value 4912 IntentStateInProgress = "InProgress" 4913 4914 // IntentStateReadyForFulfillment is a IntentState enum value 4915 IntentStateReadyForFulfillment = "ReadyForFulfillment" 4916 4917 // IntentStateWaiting is a IntentState enum value 4918 IntentStateWaiting = "Waiting" 4919) 4920 4921// IntentState_Values returns all elements of the IntentState enum 4922func IntentState_Values() []string { 4923 return []string{ 4924 IntentStateFailed, 4925 IntentStateFulfilled, 4926 IntentStateInProgress, 4927 IntentStateReadyForFulfillment, 4928 IntentStateWaiting, 4929 } 4930} 4931 4932const ( 4933 // MessageContentTypeCustomPayload is a MessageContentType enum value 4934 MessageContentTypeCustomPayload = "CustomPayload" 4935 4936 // MessageContentTypeImageResponseCard is a MessageContentType enum value 4937 MessageContentTypeImageResponseCard = "ImageResponseCard" 4938 4939 // MessageContentTypePlainText is a MessageContentType enum value 4940 MessageContentTypePlainText = "PlainText" 4941 4942 // MessageContentTypeSsml is a MessageContentType enum value 4943 MessageContentTypeSsml = "SSML" 4944) 4945 4946// MessageContentType_Values returns all elements of the MessageContentType enum 4947func MessageContentType_Values() []string { 4948 return []string{ 4949 MessageContentTypeCustomPayload, 4950 MessageContentTypeImageResponseCard, 4951 MessageContentTypePlainText, 4952 MessageContentTypeSsml, 4953 } 4954} 4955 4956const ( 4957 // PlaybackInterruptionReasonDtmfStartDetected is a PlaybackInterruptionReason enum value 4958 PlaybackInterruptionReasonDtmfStartDetected = "DTMF_START_DETECTED" 4959 4960 // PlaybackInterruptionReasonTextDetected is a PlaybackInterruptionReason enum value 4961 PlaybackInterruptionReasonTextDetected = "TEXT_DETECTED" 4962 4963 // PlaybackInterruptionReasonVoiceStartDetected is a PlaybackInterruptionReason enum value 4964 PlaybackInterruptionReasonVoiceStartDetected = "VOICE_START_DETECTED" 4965) 4966 4967// PlaybackInterruptionReason_Values returns all elements of the PlaybackInterruptionReason enum 4968func PlaybackInterruptionReason_Values() []string { 4969 return []string{ 4970 PlaybackInterruptionReasonDtmfStartDetected, 4971 PlaybackInterruptionReasonTextDetected, 4972 PlaybackInterruptionReasonVoiceStartDetected, 4973 } 4974} 4975 4976const ( 4977 // SentimentTypeMixed is a SentimentType enum value 4978 SentimentTypeMixed = "MIXED" 4979 4980 // SentimentTypeNegative is a SentimentType enum value 4981 SentimentTypeNegative = "NEGATIVE" 4982 4983 // SentimentTypeNeutral is a SentimentType enum value 4984 SentimentTypeNeutral = "NEUTRAL" 4985 4986 // SentimentTypePositive is a SentimentType enum value 4987 SentimentTypePositive = "POSITIVE" 4988) 4989 4990// SentimentType_Values returns all elements of the SentimentType enum 4991func SentimentType_Values() []string { 4992 return []string{ 4993 SentimentTypeMixed, 4994 SentimentTypeNegative, 4995 SentimentTypeNeutral, 4996 SentimentTypePositive, 4997 } 4998} 4999