Search in sources :

Example 1 with PlainTextOutputSpeech

use of com.amazon.speech.ui.PlainTextOutputSpeech in project amos-ss17-alexa by c-i-ber.

the class BankAccountService method getSpeechletResponse.

private SpeechletResponse getSpeechletResponse(String speechText) {
    SimpleCard card = new SimpleCard();
    card.setTitle(CARD_NAME);
    card.setContent(speechText);
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    speech.setText(speechText);
    return SpeechletResponse.newTellResponse(speech, card);
}
Also used : SimpleCard(com.amazon.speech.ui.SimpleCard) PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech)

Example 2 with PlainTextOutputSpeech

use of com.amazon.speech.ui.PlainTextOutputSpeech in project amos-ss17-alexa by c-i-ber.

the class ReplacementCardDialog method cancelDialog.

private SpeechletResponse cancelDialog() {
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    speech.setText("");
    return SpeechletResponse.newTellResponse(speech);
}
Also used : PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech)

Example 3 with PlainTextOutputSpeech

use of com.amazon.speech.ui.PlainTextOutputSpeech in project amos-ss17-alexa by c-i-ber.

the class ReplacementCardDialog method askIfBlockedOrDamaged.

private SpeechletResponse askIfBlockedOrDamaged(Intent intent, SessionStorage.Storage storage) {
    String fourDigits = intent.getSlot("FourDigits").getValue();
    logger.info("Digits: " + fourDigits);
    boolean validDigits = false;
    // Check if these digits are valid
    List<String> userCards = (List<String>) storage.get(STORAGE_VALID_CARDS);
    for (String cardNumber : userCards) {
        if (cardNumber.substring(cardNumber.length() - 4).equals(fourDigits)) {
            // Digits are valid
            storage.put(STORAGE_SELECTED_CARD, cardNumber);
            validDigits = true;
            break;
        }
    }
    // If these are invalid digits, ask again
    if (!validDigits) {
        return askForCardNumber(storage, true);
    }
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    speech.setText("Wurde die Karte gesperrt oder wurde sie beschädigt?");
    // Create reprompt
    Reprompt reprompt = new Reprompt();
    reprompt.setOutputSpeech(speech);
    return SpeechletResponse.newAskResponse(speech, reprompt);
}
Also used : Reprompt(com.amazon.speech.ui.Reprompt) ArrayList(java.util.ArrayList) List(java.util.List) PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech)

Example 4 with PlainTextOutputSpeech

use of com.amazon.speech.ui.PlainTextOutputSpeech in project amos-ss17-alexa by c-i-ber.

the class StandingOrderDialog method getStandingOrdersDeleteResponse.

private SpeechletResponse getStandingOrdersDeleteResponse(Intent intent, SessionStorage.Storage storage) {
    LOGGER.info("StandingOrdersDeleteResponse called.");
    String standingOrderToDelete = (String) storage.get("StandingOrderToDelete");
    // Create the Simple card content.
    SimpleCard card = new SimpleCard();
    card.setTitle("Lösche Dauerauftrag");
    // Create the plain text output.
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    ApiHelper helper = new ApiHelper();
    try {
        helper.sendDelete("http://amos-bank-lb-723794096.eu-central-1.elb.amazonaws.com/api/v1_0/accounts/9999999999/standingorders/" + standingOrderToDelete);
    } catch (Exception e) {
        LOGGER.error(e.getMessage());
        card.setContent("Dauerauftrag Nummer " + standingOrderToDelete + " wurde nicht gefunden.");
        speech.setText("Dauerauftrag Nummer " + standingOrderToDelete + " wurde nicht gefunden.");
        return SpeechletResponse.newTellResponse(speech, card);
    }
    card.setContent("Dauerauftrag Nummer " + standingOrderToDelete + " wurde gelöscht.");
    speech.setText("Dauerauftrag Nummer " + standingOrderToDelete + " wurde geloescht.");
    return SpeechletResponse.newTellResponse(speech, card);
}
Also used : SimpleCard(com.amazon.speech.ui.SimpleCard) ApiHelper(amosalexa.ApiHelper) PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech) JSONException(com.amazonaws.util.json.JSONException) IOException(java.io.IOException) SpeechletException(com.amazon.speech.speechlet.SpeechletException)

Example 5 with PlainTextOutputSpeech

use of com.amazon.speech.ui.PlainTextOutputSpeech in project amos-ss17-alexa by c-i-ber.

the class StandingOrderDialog method askForDDeletionConfirmation.

private SpeechletResponse askForDDeletionConfirmation(Intent intent, SessionStorage.Storage storage) {
    Map<String, Slot> slots = intent.getSlots();
    Slot numberSlot = slots.get("Number");
    LOGGER.info("NumberSlot: " + numberSlot.getValue());
    storage.put("StandingOrderToDelete", numberSlot.getValue());
    // Create the plain text output
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    speech.setText("Moechtest du den Dauerauftrag mit der Nummer " + numberSlot.getValue() + " wirklich loeschen?");
    // Create reprompt
    Reprompt reprompt = new Reprompt();
    reprompt.setOutputSpeech(speech);
    return SpeechletResponse.newAskResponse(speech, reprompt);
}
Also used : Reprompt(com.amazon.speech.ui.Reprompt) Slot(com.amazon.speech.slu.Slot) PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech)

Aggregations

PlainTextOutputSpeech (com.amazon.speech.ui.PlainTextOutputSpeech)30 Reprompt (com.amazon.speech.ui.Reprompt)16 SimpleCard (com.amazon.speech.ui.SimpleCard)15 Slot (com.amazon.speech.slu.Slot)4 JSONException (com.amazonaws.util.json.JSONException)3 ApiHelper (amosalexa.ApiHelper)2 SpeechletException (com.amazon.speech.speechlet.SpeechletException)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 StandingOrder (model.banking.account.StandingOrder)2 BankingRESTClient (api.BankingRESTClient)1 Intent (com.amazon.speech.slu.Intent)1 SsmlOutputSpeech (com.amazon.speech.ui.SsmlOutputSpeech)1 JSONObject (com.amazonaws.util.json.JSONObject)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 CardResponse (model.banking.account.CardResponse)1 StandingOrderResponse (model.banking.account.StandingOrderResponse)1