use of com.amazon.speech.ui.Reprompt in project amos-ss17-alexa by c-i-ber.
the class StandingOrderDialog method getNextStandingOrderInfo.
private SpeechletResponse getNextStandingOrderInfo(SessionStorage.Storage storage) {
int nextEntry = (int) storage.get("NextStandingOrder");
StandingOrder nextSO;
StringBuilder textBuilder = new StringBuilder();
if (nextEntry < standingOrders.length) {
nextSO = standingOrders[nextEntry];
textBuilder.append("Dauerauftrag Nummer ").append(nextSO.getStandingOrderId()).append(": ");
textBuilder.append("Ueberweise ").append(nextSO.getExecutionRateString()).append(nextSO.getAmount()).append(" Euro an ").append(nextSO.getPayee()).append(".");
// Save current list offset in this session
storage.put("NextStandingOrder", nextEntry + 1);
String text = textBuilder.toString();
// Create the plain text output
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(text);
// Create reprompt
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(speech);
return SpeechletResponse.newAskResponse(speech, reprompt);
} else {
// Create the plain text output
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText("Das waren alle vorhandenen Dauerauftraege.");
return SpeechletResponse.newTellResponse(speech);
}
}
use of com.amazon.speech.ui.Reprompt in project amos-ss17-alexa by c-i-ber.
the class TestListDialog method initialList.
private SpeechletResponse initialList(SessionStorage.Storage storage) {
// Return the first three list entries
String speechText = exampleList[0] + ". " + exampleList[1] + ". " + exampleList[2] + ". Möchtest du noch mehr hören?";
// Create the plain text output
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
// Create reprompt
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(speech);
// Save current list offset in this session
storage.put("TestList.NextEntry", 3);
return SpeechletResponse.newAskResponse(speech, reprompt);
}
use of com.amazon.speech.ui.Reprompt in project amos-ss17-alexa by c-i-ber.
the class TestListDialog method nextListItem.
private SpeechletResponse nextListItem(SessionStorage.Storage storage) {
int nextEntry = (int) storage.get("TestList.NextEntry");
String speechText;
if (nextEntry < exampleList.length) {
speechText = exampleList[nextEntry] + ". Möchtest du noch mehr hören?";
// Save current list offset in this session
storage.put("TestList.NextEntry", nextEntry + 1);
// Create the plain text output
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
// Create reprompt
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(speech);
return SpeechletResponse.newAskResponse(speech, reprompt);
} else {
speechText = "Das waren alle Einträge.";
// Create the plain text output
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
return SpeechletResponse.newTellResponse(speech);
}
}
use of com.amazon.speech.ui.Reprompt in project amos-ss17-alexa by c-i-ber.
the class BlockCardService method getSpeechletResponse.
private SpeechletResponse getSpeechletResponse(String speechText, String repromptText, boolean isAskResponse) {
// Create the Simple card content.
SimpleCard card = new SimpleCard();
card.setTitle("Block Bank Card");
card.setContent(speechText);
// Create the plain text output.
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
if (isAskResponse) {
// Create reprompt
PlainTextOutputSpeech repromptSpeech = new PlainTextOutputSpeech();
repromptSpeech.setText(repromptText);
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(repromptSpeech);
return SpeechletResponse.newAskResponse(speech, reprompt, card);
} else {
return SpeechletResponse.newTellResponse(speech, card);
}
}
use of com.amazon.speech.ui.Reprompt in project amos-ss17-alexa by c-i-ber.
the class AmosAlexaSpeechlet method bankTransfer.
/**
* Transfers money and returns response with
*
* @return SpeechletResponse spoken and visual response for the given intent
*/
private SpeechletResponse bankTransfer(Map<String, Slot> slots) {
Slot amountSlot = slots.get("amount");
Slot nameSlot = slots.get("name");
String amount = amountSlot.getValue();
String name = nameSlot.getValue();
//getting response regarding account balance
this.getAccountBalanceResponse();
//transfering money
String url = "http://amos-bank-lb-723794096.eu-central-1.elb.amazonaws.com/api/v1_0/transactions";
String urlParams = "{\n" + " \"amount\" : " + amount + ",\n" + " \"sourceAccount\" : \"DE23100000001234567890\",\n" + " \"destinationAccount\" : \"DE60643995205405578292\",\n" + " \"valueDate\" : \"2017-05-16\",\n" + " \"description\" : \"Beschreibung\"\n" + "}";
ApiHelper.sendPost(url, urlParams);
//reply message
String speechText = "Die " + amount + " wurden zu " + name + " überwiesen";
// Create the Simple card content.
SimpleCard card = new SimpleCard();
card.setTitle("CreditLimit");
card.setContent(speechText);
// Create the plain text output.
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
// Create reprompt
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(speech);
return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
Aggregations