Search in sources :

Example 36 with PlainTextOutputSpeech

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

the class TestListDialog method exitIntent.

private SpeechletResponse exitIntent(SessionStorage.Storage storage) {
    String speechText = "Okay, tschüss.";
    // Create the plain text output
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    speech.setText(speechText);
    return SpeechletResponse.newTellResponse(speech);
}
Also used : PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech)

Example 37 with PlainTextOutputSpeech

use of com.amazon.speech.ui.PlainTextOutputSpeech 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 38 with PlainTextOutputSpeech

use of com.amazon.speech.ui.PlainTextOutputSpeech 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 39 with PlainTextOutputSpeech

use of com.amazon.speech.ui.PlainTextOutputSpeech 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)

Example 40 with PlainTextOutputSpeech

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

the class AmosAlexaSpeechlet method getHelpResponse.

/**
     * Creates a {@code SpeechletResponse} for the help intent.
     *
     * @return SpeechletResponse spoken and visual response for the given intent
     */
private SpeechletResponse getHelpResponse() {
    String speechText = "You can say hello to me!";
    // Create the Simple card content.
    SimpleCard card = new SimpleCard();
    card.setTitle("HelloWorld");
    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) PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech)

Aggregations

PlainTextOutputSpeech (com.amazon.speech.ui.PlainTextOutputSpeech)44 Reprompt (com.amazon.speech.ui.Reprompt)22 SimpleCard (com.amazon.speech.ui.SimpleCard)18 Slot (com.amazon.speech.slu.Slot)8 ArrayList (java.util.ArrayList)4 StandingOrder (model.banking.StandingOrder)4 JSONException (com.amazonaws.util.json.JSONException)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 ApiHelper (amosalexa.ApiHelper)2 SpeechletException (com.amazon.speech.speechlet.SpeechletException)2 SsmlOutputSpeech (com.amazon.speech.ui.SsmlOutputSpeech)2 IOException (java.io.IOException)2 List (java.util.List)2 Card (model.banking.Card)2 StandingOrder (model.banking.account.StandingOrder)2 BankingRESTClient (api.BankingRESTClient)1 Intent (com.amazon.speech.slu.Intent)1 AskForPermissionsConsentCard (com.amazon.speech.ui.AskForPermissionsConsentCard)1 JSONObject (com.amazonaws.util.json.JSONObject)1 DateFormat (java.text.DateFormat)1