-
Notifications
You must be signed in to change notification settings - Fork 481
/
Copy pathLexResponse.cs
259 lines (236 loc) · 9.87 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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
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)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("sessionAttributes")]
#endif
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)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("dialogAction")]
#endif
public LexDialogAction DialogAction { get; set; }
/// <summary>
/// If included, sets the value for one or more contexts. This is an optional field
/// For example, you can include a context to make one or more intents that have that context as an input eligible for recognition in the next turn of the conversation.
/// </summary>
[DataMember(Name = "activeContexts", EmitDefaultValue=false)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("activeContexts")]
#endif
public IList<LexActiveContext> ActiveContexts { get; set; }
/// <summary>
/// If included, sets values for one or more recent intents. You can include information for up to three intents.
/// </summary>
[DataMember(Name = "recentIntentSummaryView", EmitDefaultValue = false)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("recentIntentSummaryView")]
#endif
public IList<LexRecentIntentSummaryViewType> RecentIntentSummaryView { 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)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("type")]
#endif
public string Type { get; set; }
/// <summary>
/// The state of the fullfillment. "Fulfilled" or "Failed"
/// </summary>
[DataMember(Name = "fulfillmentState", EmitDefaultValue=false)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("fulfillmentState")]
#endif
public string FulfillmentState { get; set; }
/// <summary>
/// The message to be sent to the user.
/// </summary>
[DataMember(Name = "message", EmitDefaultValue=false)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("message")]
#endif
public LexMessage Message { get; set; }
/// <summary>
/// The intent name you want to confirm or elicit.
/// </summary>
[DataMember(Name = "intentName", EmitDefaultValue=false)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("intentName")]
#endif
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)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("slots")]
#endif
public IDictionary<string, string> Slots { get; set; }
/// <summary>
/// The slot to elicit when the Type is "ElicitSlot"
/// </summary>
[DataMember(Name = "slotToElicit", EmitDefaultValue=false)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("slotToElicit")]
#endif
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)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("responseCard")]
#endif
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)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("contentType")]
#endif
public string ContentType { get; set; }
/// <summary>
/// The message to be asked to the user by the bot.
/// </summary>
[DataMember(Name = "content", EmitDefaultValue=false)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("content")]
#endif
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)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("version")]
#endif
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)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("contentType")]
#endif
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)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("genericAttachments")]
#endif
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)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("title")]
#endif
public string Title { get; set; }
/// <summary>
/// The card's sub title.
/// </summary>
[DataMember(Name = "subTitle", EmitDefaultValue=false)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("subTitle")]
#endif
public string SubTitle { get; set; }
/// <summary>
/// URL to an image to be shown.
/// </summary>
[DataMember(Name = "imageUrl", EmitDefaultValue=false)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("imageUrl")]
#endif
public string ImageUrl { get; set; }
/// <summary>
/// URL of the attachment to be associated with the card.
/// </summary>
[DataMember(Name = "attachmentLinkUrl", EmitDefaultValue=false)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("attachmentLinkUrl")]
#endif
public string AttachmentLinkUrl { get; set; }
/// <summary>
/// The list of buttons to be displayed with the response card.
/// </summary>
[DataMember(Name = "buttons", EmitDefaultValue=false)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("buttons")]
#endif
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)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("text")]
#endif
public string Text { get; set; }
/// <summary>
/// The value of the button sent back to the server.
/// </summary>
[DataMember(Name = "value", EmitDefaultValue=false)]
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("value")]
#endif
public string Value { get; set; }
}
}
}