diff --git a/pom.xml b/pom.xml index 8ff40dbd..9070c465 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.amazon.alexa alexa-skills-kit jar - 1.3.1 + 1.4.0 Alexa Skills Kit Contains classes used by the Alexa Skills Kit. http://developer.amazon.com/ask diff --git a/src/com/amazon/speech/Sdk.java b/src/com/amazon/speech/Sdk.java index ffb200f6..7adf8bb6 100644 --- a/src/com/amazon/speech/Sdk.java +++ b/src/com/amazon/speech/Sdk.java @@ -18,7 +18,7 @@ */ public final class Sdk { /** - * The version number for this library. + * The version number for request and response layout. */ public static final String VERSION = "1.0"; diff --git a/src/com/amazon/speech/json/ContextDeserializer.java b/src/com/amazon/speech/json/ContextDeserializer.java index e917b335..a1c699aa 100644 --- a/src/com/amazon/speech/json/ContextDeserializer.java +++ b/src/com/amazon/speech/json/ContextDeserializer.java @@ -36,7 +36,7 @@ public Context deserialize(JsonParser parser, DeserializationContext context) Context.Builder contextBuilder = Context.builder(); for (SerializedInterface interfaceName : SerializedInterface.values()) { - if (messageNode.has(interfaceName.name())) { + if (messageNode.has(interfaceName.name()) && (interfaceName.getStateClass() != null)) { State state = underlyingMapper.convertValue(messageNode.get(interfaceName.name()), interfaceName.getStateClass()); diff --git a/src/com/amazon/speech/json/SerializedInterface.java b/src/com/amazon/speech/json/SerializedInterface.java index e262dcab..25591248 100644 --- a/src/com/amazon/speech/json/SerializedInterface.java +++ b/src/com/amazon/speech/json/SerializedInterface.java @@ -17,27 +17,34 @@ import com.amazon.speech.speechlet.State; import com.amazon.speech.speechlet.interfaces.audioplayer.AudioPlayerInterface; import com.amazon.speech.speechlet.interfaces.audioplayer.AudioPlayerState; +import com.amazon.speech.speechlet.interfaces.display.DisplayInterface; +import com.amazon.speech.speechlet.interfaces.display.DisplayState; import com.amazon.speech.speechlet.interfaces.system.SystemInterface; import com.amazon.speech.speechlet.interfaces.system.SystemState; +import com.amazon.speech.speechlet.interfaces.videoapp.VideoAppInterface; enum SerializedInterface { AudioPlayer(AudioPlayerInterface.class, AudioPlayerState.class), + Display(DisplayInterface.class, DisplayState.class), + VideoApp(VideoAppInterface.class, null /* no state */), System(SystemInterface.class, SystemState.class); private final Class interfaceClass; - private final Class stateClass; + private final Class> stateClass; SerializedInterface(final Class interfaceClass, - final Class stateClass) { + final Class> stateClass) { this.interfaceClass = interfaceClass; this.stateClass = stateClass; } + @SuppressWarnings("unchecked") protected Class getInterfaceClass() { return (Class) interfaceClass; } - protected Class getStateClass() { + @SuppressWarnings("unchecked") + protected > Class getStateClass() { return (Class) stateClass; } } diff --git a/src/com/amazon/speech/slu/ConfirmationStatus.java b/src/com/amazon/speech/slu/ConfirmationStatus.java index 495ad7a5..bdcc2061 100644 --- a/src/com/amazon/speech/slu/ConfirmationStatus.java +++ b/src/com/amazon/speech/slu/ConfirmationStatus.java @@ -1,3 +1,16 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + package com.amazon.speech.slu; diff --git a/src/com/amazon/speech/speechlet/Directive.java b/src/com/amazon/speech/speechlet/Directive.java index e2b43e1b..b78e944d 100644 --- a/src/com/amazon/speech/speechlet/Directive.java +++ b/src/com/amazon/speech/speechlet/Directive.java @@ -20,6 +20,9 @@ import com.amazon.speech.speechlet.interfaces.audioplayer.directive.ClearQueueDirective; import com.amazon.speech.speechlet.interfaces.audioplayer.directive.PlayDirective; import com.amazon.speech.speechlet.interfaces.audioplayer.directive.StopDirective; +import com.amazon.speech.speechlet.interfaces.core.directive.HintDirective; +import com.amazon.speech.speechlet.interfaces.display.directive.RenderTemplateDirective; +import com.amazon.speech.speechlet.interfaces.videoapp.directive.LaunchDirective; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; @@ -29,13 +32,16 @@ */ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({ + @JsonSubTypes.Type(HintDirective.class), @JsonSubTypes.Type(PlayDirective.class), @JsonSubTypes.Type(StopDirective.class), @JsonSubTypes.Type(ClearQueueDirective.class), + @JsonSubTypes.Type(RenderTemplateDirective.class), + @JsonSubTypes.Type(LaunchDirective.class), @JsonSubTypes.Type(DelegateDirective.class), @JsonSubTypes.Type(ElicitSlotDirective.class), @JsonSubTypes.Type(ConfirmSlotDirective.class), - @JsonSubTypes.Type(ConfirmIntentDirective.class), + @JsonSubTypes.Type(ConfirmIntentDirective.class) }) public abstract class Directive { } diff --git a/src/com/amazon/speech/speechlet/IntentRequest.java b/src/com/amazon/speech/speechlet/IntentRequest.java index 0a09bfb0..1f426401 100644 --- a/src/com/amazon/speech/speechlet/IntentRequest.java +++ b/src/com/amazon/speech/speechlet/IntentRequest.java @@ -16,6 +16,7 @@ import java.util.Date; import java.util.Locale; +import com.amazon.speech.json.SpeechletRequestEnvelope; import org.apache.commons.lang3.Validate; import com.amazon.speech.slu.Intent; @@ -25,7 +26,7 @@ /** * The request object containing an {@link Intent} for {@code SpeechletV2} invocation. * - * @see SpeechletV2#onIntent + * @see SpeechletV2#onIntent(SpeechletRequestEnvelope) */ @JsonTypeName("IntentRequest") public class IntentRequest extends CoreSpeechletRequest { diff --git a/src/com/amazon/speech/speechlet/LaunchRequest.java b/src/com/amazon/speech/speechlet/LaunchRequest.java index 21c9bbd8..c79d4307 100644 --- a/src/com/amazon/speech/speechlet/LaunchRequest.java +++ b/src/com/amazon/speech/speechlet/LaunchRequest.java @@ -16,6 +16,7 @@ import java.util.Date; import java.util.Locale; +import com.amazon.speech.json.SpeechletRequestEnvelope; import org.apache.commons.lang3.Validate; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/src/com/amazon/speech/speechlet/Permissions.java b/src/com/amazon/speech/speechlet/Permissions.java index ab009061..12993ee0 100644 --- a/src/com/amazon/speech/speechlet/Permissions.java +++ b/src/com/amazon/speech/speechlet/Permissions.java @@ -1,3 +1,16 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + package com.amazon.speech.speechlet; import com.fasterxml.jackson.annotation.JsonInclude; diff --git a/src/com/amazon/speech/speechlet/SessionEndedRequest.java b/src/com/amazon/speech/speechlet/SessionEndedRequest.java index 6017440c..16dc8c14 100644 --- a/src/com/amazon/speech/speechlet/SessionEndedRequest.java +++ b/src/com/amazon/speech/speechlet/SessionEndedRequest.java @@ -16,6 +16,7 @@ import java.util.Date; import java.util.Locale; +import com.amazon.speech.json.SpeechletRequestEnvelope; import org.apache.commons.lang3.Validate; import com.amazon.speech.speechlet.interfaces.system.Error; @@ -69,7 +70,8 @@ private SessionEndedRequest(final Builder builder) { private SessionEndedRequest(@JsonProperty("requestId") final String requestId, @JsonProperty("timestamp") final Date timestamp, @JsonProperty("locale") final Locale locale, - @JsonProperty("reason") final Reason reason, @JsonProperty("error") final Error error) { + @JsonProperty("reason") final Reason reason, + @JsonProperty("error") final Error error) { super(requestId, timestamp, locale); this.reason = reason; this.error = error; diff --git a/src/com/amazon/speech/speechlet/SessionStartedRequest.java b/src/com/amazon/speech/speechlet/SessionStartedRequest.java index 66b06518..fa27ae97 100644 --- a/src/com/amazon/speech/speechlet/SessionStartedRequest.java +++ b/src/com/amazon/speech/speechlet/SessionStartedRequest.java @@ -16,6 +16,7 @@ import java.util.Date; import java.util.Locale; +import com.amazon.speech.json.SpeechletRequestEnvelope; import org.apache.commons.lang3.Validate; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/src/com/amazon/speech/speechlet/Speechlet.java b/src/com/amazon/speech/speechlet/Speechlet.java index 138412dc..45dffc29 100644 --- a/src/com/amazon/speech/speechlet/Speechlet.java +++ b/src/com/amazon/speech/speechlet/Speechlet.java @@ -95,7 +95,7 @@ public interface Speechlet { /** * Callback used to notify that the session ended as a result of the user interacting, or not * interacting with the device. This method is not invoked if the {@code Speechlet} itself ended - * the session using {@link SpeechletResponse#setShouldEndSession(boolean)}. + * the session using {@link SpeechletResponse#setNullableShouldEndSession(Boolean)}. * * @param request * the end of session request diff --git a/src/com/amazon/speech/speechlet/SpeechletRequest.java b/src/com/amazon/speech/speechlet/SpeechletRequest.java index 506d0717..6bb3345f 100644 --- a/src/com/amazon/speech/speechlet/SpeechletRequest.java +++ b/src/com/amazon/speech/speechlet/SpeechletRequest.java @@ -22,6 +22,7 @@ import com.amazon.speech.speechlet.interfaces.audioplayer.request.PlaybackNearlyFinishedRequest; import com.amazon.speech.speechlet.interfaces.audioplayer.request.PlaybackStartedRequest; import com.amazon.speech.speechlet.interfaces.audioplayer.request.PlaybackStoppedRequest; +import com.amazon.speech.speechlet.interfaces.display.request.ElementSelectedRequest; import com.amazon.speech.speechlet.interfaces.playbackcontroller.request.NextCommandIssuedRequest; import com.amazon.speech.speechlet.interfaces.playbackcontroller.request.PauseCommandIssuedRequest; import com.amazon.speech.speechlet.interfaces.playbackcontroller.request.PlayCommandIssuedRequest; @@ -64,7 +65,8 @@ @Type(value = PauseCommandIssuedRequest.class), @Type(value = NextCommandIssuedRequest.class), @Type(value = PreviousCommandIssuedRequest.class), - @Type(value = ExceptionEncounteredRequest.class) + @Type(value = ExceptionEncounteredRequest.class), + @Type(value = ElementSelectedRequest.class) }) public abstract class SpeechletRequest { private final String requestId; diff --git a/src/com/amazon/speech/speechlet/SpeechletRequestDispatcher.java b/src/com/amazon/speech/speechlet/SpeechletRequestDispatcher.java index 5cc8b959..401dca1a 100644 --- a/src/com/amazon/speech/speechlet/SpeechletRequestDispatcher.java +++ b/src/com/amazon/speech/speechlet/SpeechletRequestDispatcher.java @@ -26,6 +26,9 @@ import com.amazon.speech.speechlet.interfaces.audioplayer.request.PlaybackNearlyFinishedRequest; import com.amazon.speech.speechlet.interfaces.audioplayer.request.PlaybackStartedRequest; import com.amazon.speech.speechlet.interfaces.audioplayer.request.PlaybackStoppedRequest; +import com.amazon.speech.speechlet.interfaces.display.Display; +import com.amazon.speech.speechlet.interfaces.display.request.DisplayRequest; +import com.amazon.speech.speechlet.interfaces.display.request.ElementSelectedRequest; import com.amazon.speech.speechlet.interfaces.playbackcontroller.PlaybackController; import com.amazon.speech.speechlet.interfaces.playbackcontroller.request.NextCommandIssuedRequest; import com.amazon.speech.speechlet.interfaces.playbackcontroller.request.PauseCommandIssuedRequest; @@ -202,6 +205,19 @@ public SpeechletResponseEnvelope dispatchSpeechletCall( .onExceptionEncountered(typeSpecificRequestEnvelope); } } + /** Display **/ + } else if (speechletRequest instanceof DisplayRequest) { + if (speechletWithInterfaces instanceof Display) { + Display displaySpeechlet = (Display) speechletWithInterfaces; + if (speechletRequest instanceof ElementSelectedRequest) { + @SuppressWarnings("unchecked") + SpeechletRequestEnvelope typeSpecificRequestEnvelope = + (SpeechletRequestEnvelope) requestEnvelope; + speechletResponse = + displaySpeechlet.onElementSelected(typeSpecificRequestEnvelope); + saveSessionAttributes = shouldSaveSessionAttributes(speechletResponse); + } + } /** SpeechletV2 **/ } else if (speechletRequest instanceof CoreSpeechletRequest) { try { @@ -223,11 +239,7 @@ public SpeechletResponseEnvelope dispatchSpeechletCall( speechletResponse = speechlet.onLaunch(parameterizedRequestEnvelope); } - if (speechletResponse != null) { - saveSessionAttributes = !speechletResponse.getShouldEndSession(); - } else { - saveSessionAttributes = true; - } + saveSessionAttributes = shouldSaveSessionAttributes(speechletResponse); } } catch (RuntimeException e) { // Doing this to preserve backwards compatibility if a Speechlet instead of a @@ -258,4 +270,12 @@ public SpeechletResponseEnvelope dispatchSpeechletCall( return responseEnvelope; } + + private boolean shouldSaveSessionAttributes(SpeechletResponse speechletResponse) { + if (speechletResponse != null && speechletResponse.getNullableShouldEndSession() != null) { + return !speechletResponse.getNullableShouldEndSession(); + } else { + return true; + } + } } diff --git a/src/com/amazon/speech/speechlet/SpeechletResponse.java b/src/com/amazon/speech/speechlet/SpeechletResponse.java index 13cbad70..651a3514 100644 --- a/src/com/amazon/speech/speechlet/SpeechletResponse.java +++ b/src/com/amazon/speech/speechlet/SpeechletResponse.java @@ -15,6 +15,7 @@ import java.util.List; +import com.amazon.speech.json.SpeechletRequestEnvelope; import com.amazon.speech.ui.Card; import com.amazon.speech.ui.OutputSpeech; import com.amazon.speech.ui.Reprompt; @@ -32,7 +33,7 @@ public class SpeechletResponse { private Card card = null; private List directives = null; private Reprompt reprompt = null; - private boolean shouldEndSession = true; + private Boolean shouldEndSession = true; /** * Returns the speech associated with this response. @@ -55,10 +56,17 @@ public void setOutputSpeech(final OutputSpeech outputSpeech) { /** * Returns whether or not the session should end with this response. + * in case of {@code null} value returns {@code false} * * @return whether the session should end + * + * @deprecated with version 1.4.0 replaced with {@link #getNullableShouldEndSession()} */ + @Deprecated public boolean getShouldEndSession() { + if(shouldEndSession==null) { + return false; + } return shouldEndSession; } @@ -67,11 +75,44 @@ public boolean getShouldEndSession() { * * @param shouldEndSession * {@code true} if the session should end with this response + * + * @deprecated with version 1.4.0 {@code null} value is allowed. + * See {@link #setNullableShouldEndSession(Boolean)} */ + @Deprecated public void setShouldEndSession(final boolean shouldEndSession) { this.shouldEndSession = shouldEndSession; } + /** + * Returns value of shouldEndSession attribute + *

{@code false} means session should be kept open and voice command is expected + *

{@code true} means session should be terminated + *

{@code null} for non-display cases defaults to {@code true} and for display template + * scenarios keeps session open without expecting voice command + *

Refer to online documentation for more information + * + * @return value of shouldEndSession attribute + */ + public Boolean getNullableShouldEndSession() { + return shouldEndSession; + } + + /** + * Sets value of shouldEndSession attribute + *

Set it to {@code true} to end session + *

Set it to {@code false} to keep session open and wait for a voice command or response + *

Set it to {@code null} to keep session open without waiting for a voice command when + * displaying template. If no template is displayed it will default to + * previous behavior and end session. + *

Refer to online documentation for more details. + * + * @param shouldEndSession + * new value of shouldEndSession attribute + */ + public void setNullableShouldEndSession(final Boolean shouldEndSession) { + this.shouldEndSession = shouldEndSession; + } /** * Returns the UI card associated with this response. * @@ -146,7 +187,7 @@ public static SpeechletResponse newTellResponse(final OutputSpeech outputSpeech) } SpeechletResponse response = new SpeechletResponse(); - response.setShouldEndSession(true); + response.setNullableShouldEndSession(true); response.setOutputSpeech(outputSpeech); return response; } @@ -200,7 +241,7 @@ public static SpeechletResponse newAskResponse(final OutputSpeech outputSpeech, } SpeechletResponse response = new SpeechletResponse(); - response.setShouldEndSession(false); + response.setNullableShouldEndSession(false); response.setOutputSpeech(outputSpeech); response.setReprompt(reprompt); return response; diff --git a/src/com/amazon/speech/speechlet/SpeechletV2.java b/src/com/amazon/speech/speechlet/SpeechletV2.java index 48660272..f5a5b5ab 100644 --- a/src/com/amazon/speech/speechlet/SpeechletV2.java +++ b/src/com/amazon/speech/speechlet/SpeechletV2.java @@ -89,7 +89,7 @@ public interface SpeechletV2 { /** * Callback used to notify that the session ended as a result of the user interacting, or not * interacting with the device. This method is not invoked if the {@code SpeechletV2} itself - * ended the session using {@link SpeechletResponse#setShouldEndSession(boolean)}. + * ended the session using {@link SpeechletResponse#setNullableShouldEndSession(Boolean)}. * * @param requestEnvelope * the end of session request envelope diff --git a/src/com/amazon/speech/speechlet/dialog/directives/ConfirmIntentDirective.java b/src/com/amazon/speech/speechlet/dialog/directives/ConfirmIntentDirective.java index ee4c024b..da23209c 100644 --- a/src/com/amazon/speech/speechlet/dialog/directives/ConfirmIntentDirective.java +++ b/src/com/amazon/speech/speechlet/dialog/directives/ConfirmIntentDirective.java @@ -1,3 +1,16 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + package com.amazon.speech.speechlet.dialog.directives; import com.fasterxml.jackson.annotation.JsonTypeName; diff --git a/src/com/amazon/speech/speechlet/dialog/directives/ConfirmSlotDirective.java b/src/com/amazon/speech/speechlet/dialog/directives/ConfirmSlotDirective.java index 7b08f884..31c74bca 100644 --- a/src/com/amazon/speech/speechlet/dialog/directives/ConfirmSlotDirective.java +++ b/src/com/amazon/speech/speechlet/dialog/directives/ConfirmSlotDirective.java @@ -1,3 +1,16 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + package com.amazon.speech.speechlet.dialog.directives; import com.fasterxml.jackson.annotation.JsonTypeName; diff --git a/src/com/amazon/speech/speechlet/dialog/directives/DelegateDirective.java b/src/com/amazon/speech/speechlet/dialog/directives/DelegateDirective.java index 361ab7bb..14af333a 100644 --- a/src/com/amazon/speech/speechlet/dialog/directives/DelegateDirective.java +++ b/src/com/amazon/speech/speechlet/dialog/directives/DelegateDirective.java @@ -1,3 +1,16 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + package com.amazon.speech.speechlet.dialog.directives; import com.fasterxml.jackson.annotation.JsonTypeName; diff --git a/src/com/amazon/speech/speechlet/dialog/directives/DialogDirective.java b/src/com/amazon/speech/speechlet/dialog/directives/DialogDirective.java index f714d130..0af36146 100644 --- a/src/com/amazon/speech/speechlet/dialog/directives/DialogDirective.java +++ b/src/com/amazon/speech/speechlet/dialog/directives/DialogDirective.java @@ -1,3 +1,16 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + package com.amazon.speech.speechlet.dialog.directives; import com.amazon.speech.speechlet.Directive; diff --git a/src/com/amazon/speech/speechlet/dialog/directives/DialogIntent.java b/src/com/amazon/speech/speechlet/dialog/directives/DialogIntent.java index 7f04871f..e32d759e 100644 --- a/src/com/amazon/speech/speechlet/dialog/directives/DialogIntent.java +++ b/src/com/amazon/speech/speechlet/dialog/directives/DialogIntent.java @@ -1,3 +1,16 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + package com.amazon.speech.speechlet.dialog.directives; import java.util.HashMap; diff --git a/src/com/amazon/speech/speechlet/dialog/directives/DialogSlot.java b/src/com/amazon/speech/speechlet/dialog/directives/DialogSlot.java index 54ae68f2..e6a06430 100644 --- a/src/com/amazon/speech/speechlet/dialog/directives/DialogSlot.java +++ b/src/com/amazon/speech/speechlet/dialog/directives/DialogSlot.java @@ -1,3 +1,16 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + package com.amazon.speech.speechlet.dialog.directives; import com.amazon.speech.slu.ConfirmationStatus; @@ -5,9 +18,11 @@ import com.amazon.speech.slu.Slot; /** - * Used by a skill to update the intent name and/or one or more slot values during a multi-turn dialog. + * Used by a skill to update the intent name and/or one or more slot values during a multi-turn + * dialog. * * @see DialogDirective#setUpdatedIntent(DialogIntent) + * @see DialogIntent#setSlots(java.util.Map) */ public class DialogSlot { @@ -15,23 +30,47 @@ public class DialogSlot { private String value; private ConfirmationStatus confirmationStatus; - public DialogSlot(final String name, final String value, final ConfirmationStatus confirmationStatus) { + /** + * Constructs a dialog slot from name, value and confirmation status. + * + * @param name + * the name of dialog slot + * @param value + * the value of dialog slot or {@code null} if undefined + * @param confirmationStatus + * the confirmation status for dialog slot, or {@link ConfirmationStatus#NONE} if + * unknown + * @see ConfirmationStatus + */ + public DialogSlot(final String name, final String value, + final ConfirmationStatus confirmationStatus) { this.name = name; this.value = value; this.confirmationStatus = confirmationStatus; } + /** + * Constructs a dialog slot from name and value, sets confirmation status as {@code null}. + * + * @param name + * the name of dialog slot + * @param value + * the value of dialog slot or {@code null} if undefined + */ public DialogSlot(final String name, final String value) { this(name, value, null); } + /** + * Constructs a dialog slot, sets name, value and confirmation status as {@code null}. + */ public DialogSlot() { this(null, null, null); } /** - * Create a slot object for a dialog response from a given {@link Slot} object from the {@link Intent} object - * within an {@link com.amazon.speech.speechlet.IntentRequest}. + * Creates a slot object for a dialog response from a given {@link Slot} object from the + * {@link Intent} object within an {@link com.amazon.speech.speechlet.IntentRequest}. * * @param requestSlot the slot given */ @@ -39,26 +78,61 @@ public DialogSlot(final Slot requestSlot) { this(requestSlot.getName(), requestSlot.getValue(), requestSlot.getConfirmationStatus()); } + /** + * Returns the name of dialog slot. + * + * @return the name of dialog slot + */ public String getName() { return name; } + /** + * Sets the name for dialog slot. + * + * @param name + * the name of dialog slot + */ public void setName(final String name) { this.name = name; } + /** + * Returns the value of dialog slot or {@code none} if undefined. + * + * @return the value of dialog slot or {@code none} if undefined + */ public String getValue() { return value; } + /** + * Sets the value for dialog slot. + * + * @param value + * the value for dialog slot. + */ public void setValue(final String value) { this.value = value; } + /** + * Returns the confirmation status for dialog slot. + * + * @return the confirmation status for dialog slot + * @see ConfirmationStatus + */ public ConfirmationStatus getConfirmationStatus() { return confirmationStatus; } + /** + * Sets the confirmation status for dialog slot. + * + * @param confirmationStatus + * the confirmation status for dialog slot + * @see ConfirmationStatus + */ public void setConfirmationStatus(final ConfirmationStatus confirmationStatus) { this.confirmationStatus = confirmationStatus; } diff --git a/src/com/amazon/speech/speechlet/dialog/directives/ElicitSlotDirective.java b/src/com/amazon/speech/speechlet/dialog/directives/ElicitSlotDirective.java index f8062365..967a26dd 100644 --- a/src/com/amazon/speech/speechlet/dialog/directives/ElicitSlotDirective.java +++ b/src/com/amazon/speech/speechlet/dialog/directives/ElicitSlotDirective.java @@ -1,3 +1,16 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + package com.amazon.speech.speechlet.dialog.directives; import com.fasterxml.jackson.annotation.JsonTypeName; diff --git a/src/com/amazon/speech/speechlet/interfaces/core/Hint.java b/src/com/amazon/speech/speechlet/interfaces/core/Hint.java new file mode 100644 index 00000000..0395b520 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/core/Hint.java @@ -0,0 +1,31 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.core; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonSubTypes.Type; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeInfo.As; +import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; + +/** + * Base class for a hint to be rendered to the user. + */ +@JsonTypeInfo(use = Id.NAME, include = As.PROPERTY, property = "type") +@JsonSubTypes({ @Type(value = PlainTextHint.class), +}) +// The sub types that extend the OutputSpeech class +public class Hint { + +} diff --git a/src/com/amazon/speech/speechlet/interfaces/core/PlainTextHint.java b/src/com/amazon/speech/speechlet/interfaces/core/PlainTextHint.java new file mode 100644 index 00000000..26746cd1 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/core/PlainTextHint.java @@ -0,0 +1,43 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.core; + +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A textual hint to be rendered to the user. + */ +@JsonTypeName("PlainText") +public class PlainTextHint extends Hint { + private String text; + + /** + * Returns the text of the hint. + * + * @return the hint text + */ + public String getText() { + return text; + } + + /** + * Sets the text for the hint. + * + * @param text + * the hint text + */ + public void setText(String text) { + this.text = text; + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/core/directive/HintDirective.java b/src/com/amazon/speech/speechlet/interfaces/core/directive/HintDirective.java new file mode 100644 index 00000000..8b136640 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/core/directive/HintDirective.java @@ -0,0 +1,45 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.core.directive; + +import com.amazon.speech.speechlet.Directive; +import com.amazon.speech.speechlet.interfaces.core.Hint; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The hint directive renders a hint to customer when there is an appropriate rendering mechanism. + */ +@JsonTypeName("Hint") +public class HintDirective extends Directive { + private Hint hint; + + /** + * Returns the hint. + * + * @return the hint + */ + public Hint getHint() { + return hint; + } + + /** + * Sets the hint to be rendered. + * + * @param hint + * the hint to render + */ + public void setHint(Hint hint) { + this.hint = hint; + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/Display.java b/src/com/amazon/speech/speechlet/interfaces/display/Display.java new file mode 100644 index 00000000..a0baa07d --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/Display.java @@ -0,0 +1,36 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.display; + +import com.amazon.speech.json.SpeechletRequestEnvelope; +import com.amazon.speech.speechlet.SpeechletResponse; +import com.amazon.speech.speechlet.interfaces.display.request.ElementSelectedRequest; + +/** + * Interactions between a user and a screen-enabled Alexa device can include rich, interactive + * display templates shown on the screen. These are graphical elements that complement the voice + * interaction. A custom skill can include display templates in its response. This interface allows + * you to handle input events associated with these on-screen elements. + */ +public interface Display { + /** + * Entry point for an element being touched or selected on the display. + * + * @param requestEnvelope + * the request envelope containing the element selected request to handle + * @return the response, spoken and visual, to the request + */ + SpeechletResponse onElementSelected( + SpeechletRequestEnvelope requestEnvelope); +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/DisplayInterface.java b/src/com/amazon/speech/speechlet/interfaces/display/DisplayInterface.java new file mode 100644 index 00000000..bf49c8c9 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/DisplayInterface.java @@ -0,0 +1,123 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.display; + +import com.amazon.speech.speechlet.Interface; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents the presence of Display capabilities of the Alexa client. + */ +public final class DisplayInterface extends Interface { + + /** + * Default templateVersion to be used if not specified. + */ + private static final String DEFAULT_TEMPLATE_VERSION = "1.0"; + + /** + * Default markupVersion to be used if not specified. + */ + private static final String DEFAULT_MARKUP_VERSION = "1.0"; + + /** + * The type of state returned for this interface, to be passed in as the second argument for + * {@code Context#getState(Interface, State)}. + */ + public static final Class STATE_TYPE = DisplayState.class; + + /** + * Supported templateVersion. + */ + private final String templateVersion; + + /** + * Supported markupVersion. + */ + private final String markupVersion; + + /** + * Returns a new builder instance used to construct a new {@code DisplayInterface}. + * + * @return the builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Private constructor used for JSON serialization. + * + * @param templateVersion + * the supported template version + * @param markupVersion + * the supported markup version + */ + private DisplayInterface(@JsonProperty("templateVersion") final String templateVersion, + @JsonProperty("markupVersion") final String markupVersion) { + this.templateVersion = templateVersion; + this.markupVersion = markupVersion; + } + + /** + * Private constructor to return a new {@code DisplayInterface} from a {@code Builder}. + * + * @param builder + * the builder used to construct the {@code DisplayInterface} + */ + private DisplayInterface(final Builder builder) { + this.templateVersion = builder.templateVersion; + this.markupVersion = builder.markupVersion; + } + + /** + * Returns the current supported {@code templateVersion}. + */ + public String getTemplateVersion() { + return this.templateVersion; + } + + /** + * Returns the current supported {@code markupVersion}. + */ + public String getMarkupVersion() { + return this.markupVersion; + } + + /** + * Builder used to construct a new {@code DisplayInterface}. + */ + public static final class Builder { + private String templateVersion = DisplayInterface.DEFAULT_TEMPLATE_VERSION; + + private String markupVersion = DisplayInterface.DEFAULT_MARKUP_VERSION; + + private Builder() { + } + + public Builder withTemplateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + + public Builder withMarkupVersion(String markupVersion) { + this.markupVersion = markupVersion; + return this; + } + + public DisplayInterface build() { + return new DisplayInterface(this); + } + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/DisplayState.java b/src/com/amazon/speech/speechlet/interfaces/display/DisplayState.java new file mode 100644 index 00000000..da8aba68 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/DisplayState.java @@ -0,0 +1,81 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.display; + +import com.amazon.speech.speechlet.State; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents the state of the Display component on the device. + */ +public final class DisplayState extends State { + private final String token; + + /** + * Returns a new builder instance used to construct a new {@code DisplayState}. + * + * @return the builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Private constructor to return a new {@code DisplayState} from a {@code Builder}. + * + * @param builder + * the builder used to construct the {@code DisplayState} + */ + private DisplayState(final Builder builder) { + token = builder.token; + } + + /** + * Private constructor used for JSON serialization and for extending this class. + * + * @param token + * the current token + */ + private DisplayState(@JsonProperty("token") final String token) { + this.token = token; + } + + public String getToken() { + return token; + } + + @Override + public Class getInterfaceClass() { + return DisplayInterface.class; + } + + /** + * Builder used to construct a new {@code DisplayState}. + */ + public static final class Builder { + private String token; + + private Builder() { + } + + public Builder withToken(final String token) { + this.token = token; + return this; + } + + public DisplayState build() { + return new DisplayState(this); + } + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/directive/RenderTemplateDirective.java b/src/com/amazon/speech/speechlet/interfaces/display/directive/RenderTemplateDirective.java new file mode 100644 index 00000000..2c9d6f20 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/directive/RenderTemplateDirective.java @@ -0,0 +1,45 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.display.directive; + +import com.amazon.speech.speechlet.Directive; +import com.amazon.speech.speechlet.interfaces.display.template.Template; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * This class represents the directive sent to render a template. + */ +@JsonTypeName("Display.RenderTemplate") +public class RenderTemplateDirective extends Directive { + private Template template; + + /** + * Returns the template to be rendered by this directive. + * + * @return the template to be rendered by this directive + */ + public Template getTemplate() { + return template; + } + + /** + * Sets the template to be rendered by this directive + * + * @param template + * the template to be rendered by this directive + */ + public void setTemplate(Template template) { + this.template = template; + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/directive/package-info.java b/src/com/amazon/speech/speechlet/interfaces/display/directive/package-info.java new file mode 100644 index 00000000..f202eca2 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/directive/package-info.java @@ -0,0 +1,18 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +/** + * Contains classes used to represent the directives returned by your Alexa skill relating to the + * {@code Display} interface. + */ +package com.amazon.speech.speechlet.interfaces.display.directive; \ No newline at end of file diff --git a/src/com/amazon/speech/speechlet/interfaces/display/element/Image.java b/src/com/amazon/speech/speechlet/interfaces/display/element/Image.java new file mode 100644 index 00000000..dda40a2e --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/element/Image.java @@ -0,0 +1,116 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.display.element; + +import java.util.List; + +/** + * This class represents an image that can be embedded within a display template. When including the + * image, you may provide a number of image instances with different sizes. The image size selected + * will be the smallest possible size that matches the desired aspect ratio and gives a clear image + * for the size of the screen where the image is being rendered. If an appropriately sized URL has + * not been provided, the next larger image size will be used and scaled down. + */ +public class Image { + private String contentDescription; + + @Deprecated + private String smallSourceUrl; + + @Deprecated + private String largeSourceUrl; + + private List sources; + + /** + * Returns the content description for use by screen readers. + * + * @return the content description for use by screen readers + */ + public String getContentDescription() { + return contentDescription; + } + + /** + * Sets the content description for use by screen readers. + * + * @param contentDescription + * the content description for use by screen readers + */ + + public void setContentDescription(String contentDescription) { + this.contentDescription = contentDescription; + } + + /** + * Returns the small source URL. + * + * @return the small source URL + */ + public String getSmallSourceUrl() { + return smallSourceUrl; + } + + /** + * Sets the small source URL. This field is deprecated. Use {@link Image#setSources(List)} + * instead . + * + * @param smallSourceUrl + * the small source URL + */ + @Deprecated + public void setSmallSourceUrl(String smallSourceUrl) { + this.smallSourceUrl = smallSourceUrl; + } + + /** + * Returns the large source URL. + * + * @return the large source URL + */ + public String getLargeSourceUrl() { + return largeSourceUrl; + } + + /** + * Sets the large source URL. This field is deprecated. Use {@link Image#setSources(List)} + * instead . + * + * @param largeSourceUrl + * the large source URL + */ + @Deprecated + public void setLargeSourceUrl(String largeSourceUrl) { + this.largeSourceUrl = largeSourceUrl; + } + + /** + * Gets the list of image instances. + * + * @return the list of image instances + */ + public List getSources() { + return sources; + } + + /** + * Sets the list of image instances. + * + * @param sources + * the list of image instances + */ + public void setSources(List sources) { + this.sources = sources; + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/element/ImageInstance.java b/src/com/amazon/speech/speechlet/interfaces/display/element/ImageInstance.java new file mode 100644 index 00000000..321bc5e8 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/element/ImageInstance.java @@ -0,0 +1,103 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.display.element; + +/** + * An image resource to be displayed with optional width, height and size properties. See + * {@link Image#setSources(java.util.List)} for usage. + */ +public class ImageInstance { + private String url; + private String size; + private int widthPixels; + private int heightPixels; + + /** + * Returns the image URL. + * + * @return the image URL + */ + public String getUrl() { + return url; + } + + /** + * Sets the image URL. + * + * @param url + * the image URL + */ + public void setUrl(String url) { + this.url = url; + } + + /** + * Gets the image size. + * + * @return the image size + */ + public String getSize() { + return size; + } + + /** + * Sets the image size. + * + * @param size + * the image size + */ + public void setSize(ImageSize size) { + this.size = size.getSize(); + } + + /** + * Gets the image width in pixels. + * + * @return the image width + */ + public int getWidthPixels() { + return widthPixels; + } + + /** + * Sets the image width in pixels. If not known do not populate as this should be the exact + * image dimensions. + * + * @param widthPixels + * the image width + */ + public void setWidthPixels(int widthPixels) { + this.widthPixels = widthPixels; + } + + /** + * Gets the image height in pixels. + * + * @return the image height + */ + public int getHeightPixels() { + return heightPixels; + } + + /** + * Sets the image height in pixels. If not known do not populate as this should be the exact + * image dimensions. + * + * @param heightPixels + * the image height + */ + public void setHeightPixels(int heightPixels) { + this.heightPixels = heightPixels; + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/element/ImageSize.java b/src/com/amazon/speech/speechlet/interfaces/display/element/ImageSize.java new file mode 100644 index 00000000..81031d94 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/element/ImageSize.java @@ -0,0 +1,41 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.display.element; + +/** + * Enumerates valid image sizes to be used in an image instance. See + * {@link ImageInstance#setSize(ImageSize)} for usage. + */ +public enum ImageSize { + X_SMALL("x-small"), + SMALL("small"), + MEDIUM("medium"), + LARGE("large"), + X_LARGE("x-large"); + + private String size; + + private ImageSize(String size) { + this.size = size; + } + + /** + * Returns the size of image (x-small, small, medium, large, x-large). + * + * @return the size of image + */ + public String getSize() { + return size; + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/element/PlainText.java b/src/com/amazon/speech/speechlet/interfaces/display/element/PlainText.java new file mode 100644 index 00000000..05c30b16 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/element/PlainText.java @@ -0,0 +1,39 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.display.element; + +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * This class represents a plain text field that can be embedded within a display template. + */ +@JsonTypeName("PlainText") +public class PlainText implements TextField { + private String text; + + @Override + public String getText() { + return text; + } + + /** + * Sets the plain text on this field. + * + * @param text + * the plain text on this field + */ + public void setText(String text) { + this.text = text; + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/element/RichText.java b/src/com/amazon/speech/speechlet/interfaces/display/element/RichText.java new file mode 100644 index 00000000..5205366b --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/element/RichText.java @@ -0,0 +1,112 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.display.element; + +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + *

+ * This class represents a rich text field that can be embedded within a display template. + *

+ * + * Supported markup includes: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
NameElementExample MarkupOutput
Line Break{@code
}
{@code First line
+ * Second line}
+ * First line
+ * Second line
Bold{@code }{@code This is a ladybird beetle}This is a ladybird beetle
Italics{@code }{@code Scientific name Coccienellidae}Scientific name Coccienellidae
Underline{@code }{@code Always feed your ladybird tasty aphids.}Always feed your ladybird tasty aphids.
Font{@code } + * {@code Font size 1 }
+ * {@code Font size 2 }
+ * {@code Font size 3 }
+ * {@code Font size 4 }
+ * {@code Font size 5 }
+ * {@code Font size 6 }
+ * {@code Font size 7 }
+ *
+ *

+ * Font size 1
+ * Font size 2
+ *

+ *

+ * Font size 3
+ * Font size 4
+ * Font size 5
+ * Font size 6 + *

+ *

+ * Font size 7 + *

+ *
Action{@code }{@code Learn the history of ladybirds.}Learn the history of ladybirds.
+ */ +@JsonTypeName("RichText") +public class RichText implements TextField { + private String richText; + + @Override + public String getText() { + return richText; + } + + /** + * Sets the rich text on this field. + * + * @param richText + * the rich text on this field + */ + public void setText(String richText) { + this.richText = richText; + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/element/TextField.java b/src/com/amazon/speech/speechlet/interfaces/display/element/TextField.java new file mode 100644 index 00000000..abecd22a --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/element/TextField.java @@ -0,0 +1,34 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.display.element; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +/** + * This interface represents a text field that can be embedded within a display template. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonSubTypes({ + @JsonSubTypes.Type(RichText.class), + @JsonSubTypes.Type(PlainText.class) +}) +public interface TextField { + /** + * Returns the text for this field. + * + * @return the text for this field + */ + String getText(); +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/element/TripleTextContent.java b/src/com/amazon/speech/speechlet/interfaces/display/element/TripleTextContent.java new file mode 100644 index 00000000..8c4e6938 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/element/TripleTextContent.java @@ -0,0 +1,82 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.display.element; + +/** + * This interface represents a text content (a wrapper class) that can be embedded within a display + * template. It encapsulates primary, secondary and tertiary fields. + */ +public abstract class TripleTextContent { + private TextField primaryText; + private TextField secondaryText; + private TextField tertiaryText; + + /** + * Returns the primary text field. + * + * @return the primary text field + */ + public TextField getPrimaryText() { + return primaryText; + } + + /** + * Sets the primary text field. + * + * @param primaryText + * the primary text field + */ + public void setPrimaryText(TextField primaryText) { + this.primaryText = primaryText; + } + + /** + * Returns the secondary text field. + * + * @return the secondary text field + */ + public TextField getSecondaryText() { + return secondaryText; + } + + /** + * Sets the secondary text field. + * + * @param secondaryText + * the secondary text field + */ + public void setSecondaryText(TextField secondaryText) { + this.secondaryText = secondaryText; + } + + /** + * Returns the tertiary text field. + * + * @return the tertiary text field + */ + public TextField getTertiaryText() { + return tertiaryText; + } + + /** + * Sets the tertiary text field. + * + * @param tertiaryText + * the tertiary text field + */ + public void setTertiaryText(TextField tertiaryText) { + this.tertiaryText = tertiaryText; + } + +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/element/package-info.java b/src/com/amazon/speech/speechlet/interfaces/display/element/package-info.java new file mode 100644 index 00000000..afefb541 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/element/package-info.java @@ -0,0 +1,17 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +/** + * Contains classes that represent visual elements that can be embedded within a display template. + */ +package com.amazon.speech.speechlet.interfaces.display.element; \ No newline at end of file diff --git a/src/com/amazon/speech/speechlet/interfaces/display/package-info.java b/src/com/amazon/speech/speechlet/interfaces/display/package-info.java new file mode 100644 index 00000000..b1ebf057 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/package-info.java @@ -0,0 +1,17 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +/** + * Contains classes used by the {@code Display} interface. + */ +package com.amazon.speech.speechlet.interfaces.display; \ No newline at end of file diff --git a/src/com/amazon/speech/speechlet/interfaces/display/request/DisplayRequest.java b/src/com/amazon/speech/speechlet/interfaces/display/request/DisplayRequest.java new file mode 100644 index 00000000..5bd5e2f2 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/request/DisplayRequest.java @@ -0,0 +1,35 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.display.request; + +import java.util.Date; +import java.util.Locale; + +import com.amazon.speech.speechlet.SpeechletRequest; + +/** + * Base class for requests used for {@code Display} invocation. + * + * @see com.amazon.speech.speechlet.interfaces.display.Display + */ +public class DisplayRequest extends SpeechletRequest { + protected DisplayRequest(SpeechletRequestBuilder builder) { + super(builder); + } + + protected DisplayRequest(final String requestId, final Date timestamp, + final Locale locale) { + super(requestId, timestamp, locale); + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/request/ElementSelectedRequest.java b/src/com/amazon/speech/speechlet/interfaces/display/request/ElementSelectedRequest.java new file mode 100644 index 00000000..f460c0a6 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/request/ElementSelectedRequest.java @@ -0,0 +1,102 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.display.request; + +import java.util.Date; +import java.util.Locale; + +import org.apache.commons.lang3.Validate; + +import com.amazon.speech.speechlet.SpeechletRequest; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The request object indicating that an element has been touched or selected on the display. + */ +@JsonTypeName("Display.ElementSelected") +public class ElementSelectedRequest extends DisplayRequest { + private final String token; + + /** + * Returns a new builder instance used to construct a new {@code ElementSelectedRequest}. + * + * @return the builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Private constructor to return a new {@code ElementSelectedRequest} from a {@code Builder}. + * + * @param builder + * the builder used to construct the {@code ElementSelectedRequest} + */ + private ElementSelectedRequest(final Builder builder) { + super(builder); + this.token = builder.token; + } + + /** + * Protected constructor used for JSON serialization and for extending this class. + * + * @param requestId + * the request identifier + * @param timestamp + * the request timestamp + * @param locale + * the locale of the request + * @param token + * the token that represents the selected item + */ + private ElementSelectedRequest(@JsonProperty("requestId") final String requestId, + @JsonProperty("timestamp") final Date timestamp, + @JsonProperty("locale") final Locale locale, + @JsonProperty("token") final String token) { + super(requestId, timestamp, locale); + this.token = token; + } + + /** + * Returns the token of the selected element + * + * @return the selected element's token that was attached when the list was rendered + */ + public String getToken() { + return token; + } + + /** + * Builder used to construct a new {@code ElementSelectedRequest}. + */ + public static final class Builder extends + SpeechletRequest.SpeechletRequestBuilder { + private String token; + + private Builder() { + } + + public Builder withToken(final String token) { + this.token = token; + return this; + } + + @Override + public ElementSelectedRequest build() { + Validate.notBlank(getRequestId(), "RequestId must be defined"); + return new ElementSelectedRequest(this); + } + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/request/package-info.java b/src/com/amazon/speech/speechlet/interfaces/display/request/package-info.java new file mode 100644 index 00000000..0bb7cc0f --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/request/package-info.java @@ -0,0 +1,20 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +/** + * Contains classes used to represent the requests sent to your Alexa skill relating to the + * {@code Display} interface. + * + * @see com.amazon.speech.speechlet.interfaces.display.Display + */ +package com.amazon.speech.speechlet.interfaces.display.request; \ No newline at end of file diff --git a/src/com/amazon/speech/speechlet/interfaces/display/template/BodyTemplate1.java b/src/com/amazon/speech/speechlet/interfaces/display/template/BodyTemplate1.java new file mode 100644 index 00000000..bdec91bf --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/template/BodyTemplate1.java @@ -0,0 +1,100 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.display.template; + +import com.amazon.speech.speechlet.interfaces.display.element.Image; +import com.amazon.speech.speechlet.interfaces.display.element.TripleTextContent; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * This body template is comprised of the following elements: + *
    + *
  • An optional full-screen background image
  • + *
  • A text field
  • + *
  • An optional title
  • + *
+ * + *

+ * For layout specifics, please refer to our template documentation. + *

+ */ +@JsonTypeName("BodyTemplate1") +public class BodyTemplate1 extends Template { + private Image backgroundImage; + + private String title; + + private TextContent textContent; + + /** + * Returns the background image. + * + * @return the background image + */ + public Image getBackgroundImage() { + return backgroundImage; + } + + /** + * Sets the background image. + * + * @param backgroundImage + * the background image + */ + public void setBackgroundImage(Image backgroundImage) { + this.backgroundImage = backgroundImage; + } + + /** + * Returns the title. + * + * @return the title + */ + public String getTitle() { + return title; + } + + /** + * Sets the title. + * + * @param title + * the title + */ + public void setTitle(String title) { + this.title = title; + } + + /** + * Returns the text content. + * + * @return the text content + */ + public TextContent getTextContent() { + return textContent; + } + + /** + * Sets the text content for the template. + * + * @param textContent + * the text content + */ + public void setTextContent(TextContent textContent) { + this.textContent = textContent; + } + + public static class TextContent extends TripleTextContent { + + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/template/BodyTemplate2.java b/src/com/amazon/speech/speechlet/interfaces/display/template/BodyTemplate2.java new file mode 100644 index 00000000..334e721d --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/template/BodyTemplate2.java @@ -0,0 +1,121 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.display.template; + +import com.amazon.speech.speechlet.interfaces.display.element.Image; +import com.amazon.speech.speechlet.interfaces.display.element.TripleTextContent; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * This body template is comprised of the following elements: + *
    + *
  • An optional full-screen background image
  • + *
  • An image (rectangular, square)
  • + *
  • A text field
  • + *
  • An optional title
  • + *
+ * + *

+ * For layout specifics, please refer to our template documentation. + *

+ */ +@JsonTypeName("BodyTemplate2") +public class BodyTemplate2 extends Template { + private Image backgroundImage; + private Image image; + + private String title; + + private TextContent textContent; + + /** + * Returns the background image. + * + * @return the background image + */ + public Image getBackgroundImage() { + return backgroundImage; + } + + /** + * Sets the background image. + * + * @param backgroundImage + * the background image + */ + public void setBackgroundImage(Image backgroundImage) { + this.backgroundImage = backgroundImage; + } + + /** + * Returns the title. + * + * @return the title + */ + public String getTitle() { + return title; + } + + /** + * Sets the title. + * + * @param title + * the title + */ + public void setTitle(String title) { + this.title = title; + } + + /** + * Returns the image. + * + * @return the image + */ + public Image getImage() { + return image; + } + + /** + * Sets the image. + * + * @param image + * the image + */ + public void setImage(Image image) { + this.image = image; + } + + /** + * Returns the text content. + * + * @return the text content + */ + public TextContent getTextContent() { + return textContent; + } + + /** + * Sets the text content for the template. + * + * @param textContent + * the text content + */ + public void setTextContent(TextContent textContent) { + this.textContent = textContent; + } + + public static class TextContent extends TripleTextContent { + + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/template/BodyTemplate3.java b/src/com/amazon/speech/speechlet/interfaces/display/template/BodyTemplate3.java new file mode 100644 index 00000000..6ecef405 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/template/BodyTemplate3.java @@ -0,0 +1,121 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.display.template; + +import com.amazon.speech.speechlet.interfaces.display.element.Image; +import com.amazon.speech.speechlet.interfaces.display.element.TripleTextContent; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * This body template is comprised of the following elements: + *
    + *
  • An optional full-screen background image
  • + *
  • An image (rectangular, square)
  • + *
  • A text field
  • + *
  • An optional title
  • + *
+ * + *

+ * For layout specifics, please refer to our template documentation. + *

+ */ +@JsonTypeName("BodyTemplate3") +public class BodyTemplate3 extends Template { + private Image backgroundImage; + private Image image; + + private String title; + + private TextContent textContent; + + /** + * Returns the background image. + * + * @return the background image + */ + public Image getBackgroundImage() { + return backgroundImage; + } + + /** + * Sets the background image. + * + * @param backgroundImage + * the background image + */ + public void setBackgroundImage(Image backgroundImage) { + this.backgroundImage = backgroundImage; + } + + /** + * Returns the title. + * + * @return the title + */ + public String getTitle() { + return title; + } + + /** + * Sets the title. + * + * @param title + * the title + */ + public void setTitle(String title) { + this.title = title; + } + + /** + * Returns the image. + * + * @return the image + */ + public Image getImage() { + return image; + } + + /** + * Sets the image. + * + * @param image + * the image + */ + public void setImage(Image image) { + this.image = image; + } + + /** + * Returns the text content. + * + * @return the text content + */ + public TextContent getTextContent() { + return textContent; + } + + /** + * Sets the text content for the template. + * + * @param textContent + * the text content + */ + public void setTextContent(TextContent textContent) { + this.textContent = textContent; + } + + public static class TextContent extends TripleTextContent { + + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/template/BodyTemplate6.java b/src/com/amazon/speech/speechlet/interfaces/display/template/BodyTemplate6.java new file mode 100644 index 00000000..9cee51fb --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/template/BodyTemplate6.java @@ -0,0 +1,78 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.display.template; + +import com.amazon.speech.speechlet.interfaces.display.element.Image; +import com.amazon.speech.speechlet.interfaces.display.element.TripleTextContent; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * This body template is comprised of the following elements: + *
    + *
  • An optional full-screen background image
  • + *
  • A text field overlay
  • + *
+ * + *

+ * For layout specifics, please refer to our template documentation. + *

+ */ +@JsonTypeName("BodyTemplate6") +public class BodyTemplate6 extends Template { + private Image backgroundImage; + + private TextContent textContent; + + /** + * Returns the background image. + * + * @return the background image + */ + public Image getBackgroundImage() { + return backgroundImage; + } + + /** + * Sets the background image. + * + * @param backgroundImage + * the background image + */ + public void setBackgroundImage(Image backgroundImage) { + this.backgroundImage = backgroundImage; + } + + /** + * Returns the text content. + * + * @return the text content + */ + public TextContent getTextContent() { + return textContent; + } + + /** + * Sets the text content for the template. + * + * @param textContent + * the text content + */ + public void setTextContent(TextContent textContent) { + this.textContent = textContent; + } + + public static class TextContent extends TripleTextContent { + + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/template/ListItem.java b/src/com/amazon/speech/speechlet/interfaces/display/template/ListItem.java new file mode 100644 index 00000000..617bb140 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/template/ListItem.java @@ -0,0 +1,43 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.display.template; + +/** + * This class represents an item on a list. If this list item is selected by the user, your skill + * will receive an + * {@link com.amazon.speech.speechlet.interfaces.display.request.ElementSelectedRequest} with the + * supplied token. + */ +public class ListItem { + private String token; + + /** + * Returns the token. + * + * @return the token + */ + public String getToken() { + return token; + } + + /** + * Sets the token. + * + * @param token + * the token + */ + public void setToken(String token) { + this.token = token; + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/template/ListTemplate.java b/src/com/amazon/speech/speechlet/interfaces/display/template/ListTemplate.java new file mode 100644 index 00000000..7f03b094 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/template/ListTemplate.java @@ -0,0 +1,31 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.display.template; + +import java.util.List; + +/** + * List templates contain a scrollable sequence of items with which a user may interact. + * + * @param + * the specific type of list items included within a list template + */ +public abstract class ListTemplate extends Template { + /** + * Returns the list of items. + * + * @return the list of items + */ + public abstract List getListItems(); +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/template/ListTemplate1.java b/src/com/amazon/speech/speechlet/interfaces/display/template/ListTemplate1.java new file mode 100644 index 00000000..038be654 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/template/ListTemplate1.java @@ -0,0 +1,144 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.display.template; + +import java.util.List; + +import com.amazon.speech.speechlet.interfaces.display.element.Image; +import com.amazon.speech.speechlet.interfaces.display.element.TripleTextContent; +import com.amazon.speech.speechlet.interfaces.display.template.ListTemplate1.ListItem; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * This list template is comprised of the following elements: + *
    + *
  • An optional full-screen background image
  • + *
  • A scrollable sequence of {@link ListItem}s
  • + *
  • An optional title
  • + *
+ * + *

+ * For layout specifics, please refer to our template documentation. + *

+ */ +@JsonTypeName("ListTemplate1") +public class ListTemplate1 extends ListTemplate { + private Image backgroundImage; + + private List listItems; + + private String title; + + /** + * Returns the background image. + * + * @return the background image + */ + public Image getBackgroundImage() { + return backgroundImage; + } + + /** + * Sets the background image. + * + * @param backgroundImage + * the background image + */ + public void setBackgroundImage(Image backgroundImage) { + this.backgroundImage = backgroundImage; + } + + @Override + public List getListItems() { + return listItems; + } + + /** + * Sets the list of items. + * + * @param listItems + * the list of items + */ + public void setListItems(List listItems) { + this.listItems = listItems; + } + + /** + * Returns the title. + * + * @return the title + */ + public String getTitle() { + return title; + } + + /** + * Sets the title. + * + * @param title + * the title + */ + public void setTitle(String title) { + this.title = title; + } + + /** + * This list item is comprised of text and image. + */ + public static class ListItem extends + com.amazon.speech.speechlet.interfaces.display.template.ListItem { + private TextContent textContent; + private Image image; + + /** + * Returns the textContent. + * + * @return the textContent + */ + public TextContent getTextContent() { + return textContent; + } + + /** + * Sets the textConent. + * + * @param textContent the textContent to set + */ + public void setTextContent(TextContent textContent) { + this.textContent = textContent; + } + + /** + * Returns the image. + * + * @return the image + */ + public Image getImage() { + return image; + } + + /** + * Sets the image. + * + * @param image the image + */ + public void setImage(Image image) { + this.image = image; + } + + public static class TextContent extends TripleTextContent { + + } + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/template/ListTemplate2.java b/src/com/amazon/speech/speechlet/interfaces/display/template/ListTemplate2.java new file mode 100644 index 00000000..353b39a0 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/template/ListTemplate2.java @@ -0,0 +1,151 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.display.template; + +import java.util.List; + +import com.amazon.speech.speechlet.interfaces.display.element.Image; +import com.amazon.speech.speechlet.interfaces.display.element.TripleTextContent; +import com.amazon.speech.speechlet.interfaces.display.template.ListTemplate2.ListItem; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * This list template is comprised of the following elements: + *
    + *
  • An optional full-screen background image
  • + *
  • A scrollable sequence of {@link ListItem}s
  • + *
  • An optional title
  • + *
+ * + *

+ * For layout specifics, please refer to our template documentation. + *

+ */ +@JsonTypeName("ListTemplate2") +public class ListTemplate2 extends ListTemplate { + private Image backgroundImage; + + private List listItems; + + private String title; + + /** + * Returns the background image. + * + * @return the background image + */ + public Image getBackgroundImage() { + return backgroundImage; + } + + /** + * Sets the background image. + * + * @param backgroundImage + * the background image + */ + public void setBackgroundImage(Image backgroundImage) { + this.backgroundImage = backgroundImage; + } + + @Override + public List getListItems() { + return listItems; + } + + /** + * Sets the list of items. + * + * @param listItems + * the list of items + */ + public void setListItems(List listItems) { + this.listItems = listItems; + } + + /** + * Returns the title. + * + * @return the title + */ + public String getTitle() { + return title; + } + + /** + * Sets the title. + * + * @param title + * the title + */ + public void setTitle(String title) { + this.title = title; + } + + /** + * This list item is comprised of the following elements: + *
    + *
  • An image (rectangular, square)
  • + *
  • A text field
  • + *
+ */ + public static class ListItem extends + com.amazon.speech.speechlet.interfaces.display.template.ListItem { + private Image image; + + private TextContent textContent; + + /** + * Returns the image. + * + * @return the image + */ + public Image getImage() { + return image; + } + + /** + * Sets the image. + * + * @param image + * the image + */ + public void setImage(Image image) { + this.image = image; + } + + /** + * Returns the text content. + * + * @return the text content + */ + public TextContent getTextContent() { + return textContent; + } + + /** + * Sets the text content for the list item. + * + * @param textContent + * the text content + */ + public void setTextContent(TextContent textContent) { + this.textContent = textContent; + } + + public static class TextContent extends TripleTextContent { + + } + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/template/Template.java b/src/com/amazon/speech/speechlet/interfaces/display/template/Template.java new file mode 100644 index 00000000..2613a8d9 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/template/Template.java @@ -0,0 +1,96 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.display.template; + +import com.fasterxml.jackson.annotation.JsonGetter; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +/** + * This class represents a rich, interactive display template that can be rendered to the screen of + * an Alexa-enabled device. The Alexa Skills Kit provides two main categories of display templates: + *
    + *
  • A body template displays text and images.
  • + *
  • A list template displays a scrollable list of items, each with associated text and + * optional images.
  • + *
+ * + *

+ * A number of templates are available for each category of template. The templates vary in the + * size, number, and positioning of the text and images, and the scrolling of lists. + *

+ */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonSubTypes({ + @JsonSubTypes.Type(ListTemplate1.class), + @JsonSubTypes.Type(ListTemplate2.class), + + @JsonSubTypes.Type(BodyTemplate1.class), + @JsonSubTypes.Type(BodyTemplate2.class), + @JsonSubTypes.Type(BodyTemplate3.class), + @JsonSubTypes.Type(BodyTemplate6.class) +}) +public abstract class Template { + private String token; + private BackButtonBehavior backButtonBehavior = BackButtonBehavior.VISIBLE; + + /** + * Returns the token. + * + * @return the token + */ + public String getToken() { + return token; + } + + /** + * Sets the token. + * + * @param token + * the token + */ + public void setToken(String token) { + this.token = token; + } + + /** + * Returns whether the template should allow the user to return to the previous template. + * + * @return whether the user can go back + */ + @JsonGetter("backButton") + public BackButtonBehavior getBackButtonBehavior() { + return backButtonBehavior; + } + + /** + * Sets whether the template should allow the user to return to the previous template. + * + * @param backButtonBehavior + * behavior of the back button + */ + @JsonSetter("backButton") + public void setBackButtonBehavior(BackButtonBehavior backButtonBehavior) { + this.backButtonBehavior = backButtonBehavior; + } + + /** + * Template back button behavior. + */ + public static enum BackButtonBehavior { + HIDDEN, + VISIBLE; + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/display/template/package-info.java b/src/com/amazon/speech/speechlet/interfaces/display/template/package-info.java new file mode 100644 index 00000000..cb3c41f7 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/display/template/package-info.java @@ -0,0 +1,17 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +/** + * Contains classes that define templates that can be rendered to a display. + */ +package com.amazon.speech.speechlet.interfaces.display.template; \ No newline at end of file diff --git a/src/com/amazon/speech/speechlet/interfaces/messaging/request/MessageReceivedRequest.java b/src/com/amazon/speech/speechlet/interfaces/messaging/request/MessageReceivedRequest.java index c68df4d4..34680d11 100644 --- a/src/com/amazon/speech/speechlet/interfaces/messaging/request/MessageReceivedRequest.java +++ b/src/com/amazon/speech/speechlet/interfaces/messaging/request/MessageReceivedRequest.java @@ -1,3 +1,16 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + package com.amazon.speech.speechlet.interfaces.messaging.request; import java.util.Date; diff --git a/src/com/amazon/speech/speechlet/interfaces/videoapp/Metadata.java b/src/com/amazon/speech/speechlet/interfaces/videoapp/Metadata.java new file mode 100644 index 00000000..741527ca --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/videoapp/Metadata.java @@ -0,0 +1,63 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.videoapp; + +/** + * This class encapsulates a title and a subordinate title, and provides metadata to the video. + * + * @see VideoItem#setMetadata(Metadata) + */ +public class Metadata { + private String title; + + private String subtitle; + + /** + * Returns the title of video. + * + * @return the title of the video + */ + public String getTitle() { + return title; + } + + /** + * Returns the subordinate title below main title of video. + * + * @return the subordinate title of video + */ + public String getSubtitle() { + return subtitle; + } + + /** + * Sets the title of video. + * + * @param title + * the title of video + */ + public void setTitle(String title) { + this.title = title; + } + + /** + * Sets the subordinate title below main title for video. + * + * @param subtitle + * the subordinate title of video + */ + public void setSubtitle(String subtitle) { + this.subtitle = subtitle; + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/videoapp/VideoAppInterface.java b/src/com/amazon/speech/speechlet/interfaces/videoapp/VideoAppInterface.java new file mode 100644 index 00000000..db5fff03 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/videoapp/VideoAppInterface.java @@ -0,0 +1,58 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.videoapp; + +import com.amazon.speech.speechlet.Interface; + +/** + * Represents the presence of VideoApp capabilities of the Alexa client. + */ +public class VideoAppInterface extends Interface { + /** + * Returns a new builder instance used to construct a new {@code VideoAppInterface}. + * + * @return the builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Private constructor to return a new {@code VideoAppInterface} from a {@code Builder}. + * + * @param builder + * the builder used to construct the {@code VideoAppInterface} + */ + private VideoAppInterface(final Builder builder) { + } + + /** + * Private constructor to create a new {@code VideoAppInterface}; used for JSON serialization + * and for extending this class. + */ + private VideoAppInterface() { + } + + /** + * Builder used to construct a new {@code VideoAppInterface}. + */ + public static final class Builder { + private Builder() { + } + + public VideoAppInterface build() { + return new VideoAppInterface(this); + } + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/videoapp/VideoItem.java b/src/com/amazon/speech/speechlet/interfaces/videoapp/VideoItem.java new file mode 100644 index 00000000..76d2dfd3 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/videoapp/VideoItem.java @@ -0,0 +1,66 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.videoapp; + +/** + * This class represents a single video item. The + * {@link com.amazon.speech.speechlet.interfaces.videoapp.directive.LaunchDirective} will contain a + * {@code VideoItem} that will be played on user devices. The video item will contain the source and + * the metadata information of the video. + * + * @see com.amazon.speech.speechlet.interfaces.videoapp.directive.LaunchDirective#setVideoItem(VideoItem) + */ +public class VideoItem { + private String source; + + private Metadata metadata; + + /** + * Returns the video source. + * + * @return the video source + */ + public String getSource() { + return source; + } + + /** + * Sets the video source, which must be an HTTPS URL to the content. + * + * @param source + * the video source + */ + public void setSource(String source) { + this.source = source; + } + + /** + * Returns the video metadata. + * + * @return the video metadata + */ + public Metadata getMetadata() { + return metadata; + } + + /** + * Sets the video metadata. This metadata may be displayed on-device. + * + * @param metadata + * the video metadata + */ + public void setMetadata(Metadata metadata) { + this.metadata = metadata; + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/videoapp/directive/LaunchDirective.java b/src/com/amazon/speech/speechlet/interfaces/videoapp/directive/LaunchDirective.java new file mode 100644 index 00000000..f240e6a6 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/videoapp/directive/LaunchDirective.java @@ -0,0 +1,45 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +package com.amazon.speech.speechlet.interfaces.videoapp.directive; + +import com.amazon.speech.speechlet.Directive; +import com.amazon.speech.speechlet.interfaces.videoapp.VideoItem; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * This class represents the directive to launch the video player application. + */ +@JsonTypeName("VideoApp.Launch") +public class LaunchDirective extends Directive { + private VideoItem videoItem; + + /** + * Returns the video item. + * + * @return the video item + */ + public VideoItem getVideoItem() { + return videoItem; + } + + /** + * Sets the video item. + * + * @param videoItem + * the video item + */ + public void setVideoItem(VideoItem videoItem) { + this.videoItem = videoItem; + } +} diff --git a/src/com/amazon/speech/speechlet/interfaces/videoapp/directive/package-info.java b/src/com/amazon/speech/speechlet/interfaces/videoapp/directive/package-info.java new file mode 100644 index 00000000..55f86ffe --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/videoapp/directive/package-info.java @@ -0,0 +1,19 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +/** + * Contains classes used to represent the directives returned by your Alexa skill relating to the + * {@code VideoApp} interface. + */ +package com.amazon.speech.speechlet.interfaces.videoapp.directive; + diff --git a/src/com/amazon/speech/speechlet/interfaces/videoapp/package-info.java b/src/com/amazon/speech/speechlet/interfaces/videoapp/package-info.java new file mode 100644 index 00000000..5c4e55b7 --- /dev/null +++ b/src/com/amazon/speech/speechlet/interfaces/videoapp/package-info.java @@ -0,0 +1,18 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + +/** + * Contains classes used by the {@code VideoApp} interface. + */ +package com.amazon.speech.speechlet.interfaces.videoapp; + diff --git a/src/com/amazon/speech/ui/AskForPermissionsConsentCard.java b/src/com/amazon/speech/ui/AskForPermissionsConsentCard.java index 361d35fc..6cd4909c 100644 --- a/src/com/amazon/speech/ui/AskForPermissionsConsentCard.java +++ b/src/com/amazon/speech/ui/AskForPermissionsConsentCard.java @@ -1,3 +1,16 @@ +/* + Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/apache2.0/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + */ + package com.amazon.speech.ui; import java.util.Set;