public class DateTimePrompt implements HelperIntent
Helper intent response to ask user for a timezone agnostic date and time.
@ForIntent("askForDateTime")
public CompletableFuture
The following code demonstrates how to get the user's response:
@ForIntent("actions_intent_datetime")
public CompletableFuture handleDateTimeResponse(ActionRequest request) {
ResponseBuilder responseBuilder = getResponseBuilder();
DateTime dateTimeValue = request.getDateTime();
String response;
if (dateTimeValue != null) {
response = "Thank you for your response. We will see you on " +
dateTimeValue.getDate();
} else {
response = "Sorry, I didn't get that.";
}
responseBuilder.add(response);
return CompletableFuture.completedFuture(responseBuilder.build());
}
Constructor and Description |
---|
DateTimePrompt()
Helper intent response to ask user for a timezone agnostic date and time.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getName() |
java.util.Map<java.lang.String,java.lang.Object> |
getParameters() |
DateTimePrompt |
setDatePrompt(java.lang.String prompt) |
DateTimePrompt |
setDateTimePrompt(java.lang.String prompt) |
DateTimePrompt |
setTimePrompt(java.lang.String prompt) |
getName, getParameters
public DateTimePrompt()
Helper intent response to ask user for a timezone agnostic date and time.
@ForIntent("askForDateTime")
public CompletableFuture
The following code demonstrates how to get the user's response:
@ForIntent("actions_intent_datetime")
public CompletableFuture handleDateTimeResponse(ActionRequest request) {
ResponseBuilder responseBuilder = getResponseBuilder();
DateTime dateTimeValue = request.getDateTime();
String response;
if (dateTimeValue != null) {
response = "Thank you for your response. We will see you on " +
dateTimeValue.getDate();
} else {
response = "Sorry, I didn't get that.";
}
responseBuilder.add(response);
return CompletableFuture.completedFuture(responseBuilder.build());
}
public DateTimePrompt setDateTimePrompt(java.lang.String prompt)
public DateTimePrompt setDatePrompt(java.lang.String prompt)
public DateTimePrompt setTimePrompt(java.lang.String prompt)
public java.lang.String getName()
public java.util.Map<java.lang.String,java.lang.Object> getParameters()