Search in sources :

Example 31 with PlainTextOutputSpeech

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

the class StandingOrderDialog method getStandingOrdersModifyResponse.

private SpeechletResponse getStandingOrdersModifyResponse(Intent intent, SessionStorage.Storage storage) {
    String standingOrderToModify = (String) storage.get("StandingOrderToModify");
    String newAmount = (String) storage.get("NewAmount");
    String newExecutionRate = (String) storage.get("NewExecutionRate");
    String newFirstExecution = (String) storage.get("NewFirstExecution");
    ObjectMapper mapper = new ObjectMapper();
    // Create the Simple card content.
    SimpleCard card = new SimpleCard();
    card.setTitle("Ändere Dauerauftrag");
    // Create the plain text output.
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    JSONObject jsonObject = new JSONObject();
    try {
        //TODO
        jsonObject.put("payee", "Max Mustermann");
        jsonObject.put("amount", newAmount);
        jsonObject.put("destinationAccount", "DE39100000007777777777");
        jsonObject.put("firstExecution", "2017-06-01");
        jsonObject.put("executionRate", "MONTHLY");
        jsonObject.put("description", "Updated standing Order");
    } catch (JSONException e) {
        LOGGER.error(e.getMessage());
    }
    BankingRESTClient bankingRESTClient = BankingRESTClient.getInstance();
    bankingRESTClient.putBankingModelObject("/api/v1_0/accounts/9999999999/standingorders/" + standingOrderToModify, jsonObject.toString(), StandingOrder.class);
    card.setContent("Dauerauftrag Nummer " + standingOrderToModify + " wurde geändert.");
    speech.setText("Dauerauftrag Nummer " + standingOrderToModify + " wurde geaendert.");
    return SpeechletResponse.newTellResponse(speech, card);
}
Also used : JSONObject(com.amazonaws.util.json.JSONObject) SimpleCard(com.amazon.speech.ui.SimpleCard) JSONException(com.amazonaws.util.json.JSONException) PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech) BankingRESTClient(api.BankingRESTClient) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 32 with PlainTextOutputSpeech

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

the class AbstractSpeechService method getPlainTextOutputSpeech.

/**
     * Helper method for retrieving an OutputSpeech object when given a string of TTS.
     *
     * @param speechText the text that should be spoken out to the user.
     * @return an instance of SpeechOutput.
     */
protected PlainTextOutputSpeech getPlainTextOutputSpeech(String speechText) {
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    speech.setText(speechText);
    return speech;
}
Also used : PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech)

Example 33 with PlainTextOutputSpeech

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

the class DummyDepot method getSpeechletResponse.

private static SpeechletResponse getSpeechletResponse(String speechText, String repromptText) {
    // Create the Simple card content.
    SimpleCard card = new SimpleCard();
    card.setTitle("Bank Information");
    card.setContent(speechText);
    // Create the plain text output.
    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 34 with PlainTextOutputSpeech

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

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

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