github.com/Foodji/aws-lambda-go@v1.20.2/events/lex.go (about)

     1  package events
     2  
     3  type LexEvent struct {
     4  	MessageVersion    string            `json:"messageVersion,omitempty"`
     5  	InvocationSource  string            `json:"invocationSource,omitempty"`
     6  	UserID            string            `json:"userId,omitempty"`
     7  	InputTranscript   string            `json:"inputTranscript,omitempty"`
     8  	SessionAttributes SessionAttributes `json:"sessionAttributes,omitempty"`
     9  	RequestAttributes map[string]string `json:"requestAttributes,omitempty"`
    10  	Bot               *LexBot           `json:"bot,omitempty"`
    11  	OutputDialogMode  string            `json:"outputDialogMode,omitempty"`
    12  	CurrentIntent     *LexCurrentIntent `json:"currentIntent,omitempty"`
    13  	DialogAction      *LexDialogAction  `json:"dialogAction,omitempty"`
    14  }
    15  
    16  type LexBot struct {
    17  	Name    string `json:"name,omitempty"`
    18  	Alias   string `json:"alias,omitempty"`
    19  	Version string `json:"version,omitempty"`
    20  }
    21  
    22  type LexCurrentIntent struct {
    23  	Name               string                `json:"name,omitempty"`
    24  	Slots              Slots                 `json:"slots,omitempty"`
    25  	SlotDetails        map[string]SlotDetail `json:"slotDetails,omitempty"`
    26  	ConfirmationStatus string                `json:"confirmationStatus,omitempty"`
    27  }
    28  
    29  type SlotDetail struct {
    30  	Resolutions   []map[string]string `json:"resolutions,omitempty"`
    31  	OriginalValue string              `json:"originalValue,omitempty"`
    32  }
    33  
    34  type LexDialogAction struct {
    35  	Type             string            `json:"type,omitempty"`
    36  	FulfillmentState string            `json:"fulfillmentState,omitempty"`
    37  	Message          map[string]string `json:"message,omitempty"`
    38  	IntentName       string            `json:"intentName,omitempty"`
    39  	Slots            Slots             `json:"slots,omitempty"`
    40  	SlotToElicit     string            `json:"slotToElicit,omitempty"`
    41  	ResponseCard     *LexResponseCard  `json:"responseCard,omitempty"`
    42  }
    43  
    44  type SessionAttributes map[string]string
    45  
    46  type Slots map[string]*string
    47  
    48  type LexResponse struct {
    49  	SessionAttributes SessionAttributes `json:"sessionAttributes"`
    50  	DialogAction      LexDialogAction   `json:"dialogAction,omitempty"`
    51  }
    52  
    53  type LexResponseCard struct {
    54  	Version            int64        `json:"version,omitempty"`
    55  	ContentType        string       `json:"contentType,omitempty"`
    56  	GenericAttachments []Attachment `json:"genericAttachments,omitempty"`
    57  }
    58  
    59  type Attachment struct {
    60  	Title             string              `json:"title,omitempty"`
    61  	SubTitle          string              `json:"subTitle,omitempty"`
    62  	ImageURL          string              `json:"imageUrl,omitempty"`
    63  	AttachmentLinkURL string              `json:"attachmentLinkUrl,omitempty"`
    64  	Buttons           []map[string]string `json:"buttons,omitempty"`
    65  }
    66  
    67  func (h *LexEvent) Clear() {
    68  	h.Bot = nil
    69  	h.CurrentIntent = nil
    70  	h.DialogAction = nil
    71  }