forked from aws/aws-lambda-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LexResponse.cs
177 lines (156 loc) · 6.58 KB
/
LexResponse.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
namespace Amazon.Lambda.LexEvents
{
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
/// <summary>
/// This class is used as the return for AWS Lambda functions that are invoked by Lex to handle Bot interactions.
/// http://docs.aws.amazon.com/lex/latest/dg/lambda-input-response-format.html
/// </summary>
[DataContract]
public class LexResponse
{
/// <summary>
/// Application-specific session attributes. This is an optional field.
/// </summary>
[DataMember(Name = "sessionAttributes", EmitDefaultValue=false)]
public IDictionary<string, string> SessionAttributes { get; set; }
/// <summary>
/// This is the only field that is required. The value of DialogAction.Type directs
/// Amazon Lex to the next course of action, and describes what to expect from the user
/// after Amazon Lex returns a response to the client.
/// </summary>\
[DataMember(Name = "dialogAction", EmitDefaultValue=false)]
public LexDialogAction DialogAction { get; set; }
/// <summary>
/// The class representing the dialog action.
/// </summary>
[DataContract]
public class LexDialogAction
{
/// <summary>
/// The type of action for Lex to take with the response from the Lambda function.
/// </summary>
[DataMember(Name = "type", EmitDefaultValue=false)]
public string Type { get; set; }
/// <summary>
/// The state of the fullfillment. "Fulfilled" or "Failed"
/// </summary>
[DataMember(Name = "fulfillmentState", EmitDefaultValue=false)]
public string FulfillmentState { get; set; }
/// <summary>
/// The message to be sent to the user.
/// </summary>
[DataMember(Name = "message", EmitDefaultValue=false)]
public LexMessage Message { get; set; }
/// <summary>
/// The intent name you want to confirm or elicit.
/// </summary>
[DataMember(Name = "intentName", EmitDefaultValue=false)]
public string IntentName { get; set; }
/// <summary>
/// The values for all of the slots when response is of type "Delegate".
/// </summary>
[DataMember(Name = "slots", EmitDefaultValue=false)]
public IDictionary<string, string> Slots { get; set; }
/// <summary>
/// The slot to elicit when the Type is "ElicitSlot"
/// </summary>
[DataMember(Name = "slotToElicit", EmitDefaultValue=false)]
public string SlotToElicit { get; set; }
/// <summary>
/// The response card provides information back to the bot to display for the user.
/// </summary>
[DataMember(Name = "responseCard", EmitDefaultValue=false)]
public LexResponseCard ResponseCard { get; set; }
}
/// <summary>
/// The class represents the message that the bot will use.
/// </summary>
[DataContract]
public class LexMessage
{
/// <summary>
/// The content type of the message. PlainText or SSML
/// </summary>
[DataMember(Name = "contentType", EmitDefaultValue=false)]
public string ContentType { get; set; }
/// <summary>
/// The message to be asked to the user by the bot.
/// </summary>
[DataMember(Name = "content", EmitDefaultValue=false)]
public string Content { get; set; }
}
/// <summary>
/// The class representing the response card sent back to the user.
/// </summary>
[DataContract]
public class LexResponseCard
{
/// <summary>
/// The version of the response card.
/// </summary>
[DataMember(Name = "version", EmitDefaultValue=false)]
public int? Version { get; set; }
/// <summary>
/// The content type of the response card. The default is "application/vnd.amazonaws.card.generic".
/// </summary>
[DataMember(Name = "contentType", EmitDefaultValue=false)]
public string ContentType { get; set; } = "application/vnd.amazonaws.card.generic";
/// <summary>
/// The list of attachments sent back with the response card.
/// </summary>
[DataMember(Name = "genericAttachments", EmitDefaultValue=false)]
public IList<LexGenericAttachments> GenericAttachments { get; set; }
}
/// <summary>
/// The class representing generic attachments.
/// </summary>
[DataContract]
public class LexGenericAttachments
{
/// <summary>
/// The card's title.
/// </summary>
[DataMember(Name = "title", EmitDefaultValue=false)]
public string Title { get; set; }
/// <summary>
/// The card's sub title.
/// </summary>
[DataMember(Name = "subTitle", EmitDefaultValue=false)]
public string SubTitle { get; set; }
/// <summary>
/// URL to an image to be shown.
/// </summary>
[DataMember(Name = "imageUrl", EmitDefaultValue=false)]
public string ImageUrl { get; set; }
/// <summary>
/// URL of the attachment to be associated with the card.
/// </summary>
[DataMember(Name = "attachmentLinkUrl", EmitDefaultValue=false)]
public string AttachmentLinkUrl { get; set; }
/// <summary>
/// The list of buttons to be displayed with the response card.
/// </summary>
[DataMember(Name = "buttons", EmitDefaultValue=false)]
public IList<LexButton> Buttons { get; set; }
}
/// <summary>
/// The class representing a button in the response card.
/// </summary>
[DataContract]
public class LexButton
{
/// <summary>
/// The text for the button.
/// </summary>
[DataMember(Name = "text", EmitDefaultValue=false)]
public string Text { get; set; }
/// <summary>
/// The value of the button sent back to the server.
/// </summary>
[DataMember(Name = "value", EmitDefaultValue=false)]
public string Value { get; set; }
}
}
}