Search in sources :

Example 21 with Reprompt

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);
    }
}
Also used : StandingOrder(model.banking.account.StandingOrder) Reprompt(com.amazon.speech.ui.Reprompt) PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech)

Example 22 with Reprompt

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);
}
Also used : Reprompt(com.amazon.speech.ui.Reprompt) PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech)

Example 23 with 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);
    }
}
Also used : Reprompt(com.amazon.speech.ui.Reprompt) PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech)

Example 24 with Reprompt

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);
    }
}
Also used : SimpleCard(com.amazon.speech.ui.SimpleCard) Reprompt(com.amazon.speech.ui.Reprompt) PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech)

Example 25 with Reprompt

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);
}
Also used : SimpleCard(com.amazon.speech.ui.SimpleCard) Reprompt(com.amazon.speech.ui.Reprompt) Slot(com.amazon.speech.slu.Slot) PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech)

Aggregations

Reprompt (com.amazon.speech.ui.Reprompt)30 PlainTextOutputSpeech (com.amazon.speech.ui.PlainTextOutputSpeech)22 Slot (com.amazon.speech.slu.Slot)10 SimpleCard (com.amazon.speech.ui.SimpleCard)10 SsmlOutputSpeech (com.amazon.speech.ui.SsmlOutputSpeech)9 ArrayList (java.util.ArrayList)4 StandingOrder (model.banking.StandingOrder)3 List (java.util.List)2 Card (model.banking.Card)2 StandingOrder (model.banking.account.StandingOrder)2 Contact (model.db.Contact)2 ApiHelper (amosalexa.ApiHelper)1 SpeechletException (com.amazon.speech.speechlet.SpeechletException)1 JSONException (com.amazonaws.util.json.JSONException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 IOException (java.io.IOException)1 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 LinkedList (java.util.LinkedList)1 Security (model.banking.Security)1