1package events
2
3type 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	AlternativeIntents []LexAlternativeIntents `json:"alternativeIntents,omitempty"`
14	DialogAction       *LexDialogAction        `json:"dialogAction,omitempty"`
15}
16
17type LexBot struct {
18	Name    string `json:"name,omitempty"`
19	Alias   string `json:"alias,omitempty"`
20	Version string `json:"version,omitempty"`
21}
22
23type LexCurrentIntent struct {
24	Name                     string                `json:"name,omitempty"`
25	NLUIntentConfidenceScore float64               `json:"nluIntentConfidenceScore,omitempty"`
26	Slots                    Slots                 `json:"slots,omitempty"`
27	SlotDetails              map[string]SlotDetail `json:"slotDetails,omitempty"`
28	ConfirmationStatus       string                `json:"confirmationStatus,omitempty"`
29}
30
31type LexAlternativeIntents struct {
32	Name                     string                `json:"name,omitempty"`
33	NLUIntentConfidenceScore float64               `json:"nluIntentConfidenceScore,omitempty"`
34	Slots                    Slots                 `json:"slots,omitempty"`
35	SlotDetails              map[string]SlotDetail `json:"slotDetails,omitempty"`
36	ConfirmationStatus       string                `json:"confirmationStatus,omitempty"`
37}
38
39type SlotDetail struct {
40	Resolutions   []map[string]string `json:"resolutions,omitempty"`
41	OriginalValue string              `json:"originalValue,omitempty"`
42}
43
44type LexDialogAction struct {
45	Type             string            `json:"type,omitempty"`
46	FulfillmentState string            `json:"fulfillmentState,omitempty"`
47	Message          map[string]string `json:"message,omitempty"`
48	IntentName       string            `json:"intentName,omitempty"`
49	Slots            Slots             `json:"slots,omitempty"`
50	SlotToElicit     string            `json:"slotToElicit,omitempty"`
51	ResponseCard     *LexResponseCard  `json:"responseCard,omitempty"`
52}
53
54type SessionAttributes map[string]string
55
56type Slots map[string]*string
57
58type LexResponse struct {
59	SessionAttributes SessionAttributes `json:"sessionAttributes"`
60	DialogAction      LexDialogAction   `json:"dialogAction,omitempty"`
61}
62
63type LexResponseCard struct {
64	Version            int64        `json:"version,omitempty"`
65	ContentType        string       `json:"contentType,omitempty"`
66	GenericAttachments []Attachment `json:"genericAttachments,omitempty"`
67}
68
69type Attachment struct {
70	Title             string              `json:"title,omitempty"`
71	SubTitle          string              `json:"subTitle,omitempty"`
72	ImageURL          string              `json:"imageUrl,omitempty"`
73	AttachmentLinkURL string              `json:"attachmentLinkUrl,omitempty"`
74	Buttons           []map[string]string `json:"buttons,omitempty"`
75}
76
77func (h *LexEvent) Clear() {
78	h.Bot = nil
79	h.CurrentIntent = nil
80	h.DialogAction = nil
81}
82