diff --git a/Alexa.NET/Request/Type/AudioPlayerRequest.cs b/Alexa.NET/Request/Type/AudioPlayerRequest.cs index 4fa80a4..b005570 100644 --- a/Alexa.NET/Request/Type/AudioPlayerRequest.cs +++ b/Alexa.NET/Request/Type/AudioPlayerRequest.cs @@ -19,5 +19,41 @@ public class AudioPlayerRequest: Request [JsonProperty("currentPlaybackState")] public PlaybackState CurrentPlaybackState { get; set; } + + [JsonProperty("enqueuedToken")] + public string EnqueuedToken { get; set; } + + public bool HasEnqueuedItem + { + get + { + if (EnqueuedToken != null && EnqueuedToken != "") + return true; + else + return false; + } + } + + public AudioRequestType AudioRequestType + { + get + { + switch (this.Type.Split('.')[1]) + { + case "PlaybackStarted": + return AudioRequestType.PlaybackStarted; + case "PlaybackFinished": + return AudioRequestType.PlaybackStarted; + case "PlaybackStopped": + return AudioRequestType.PlaybackStopped; + case "PlaybackNearlyFinished": + return AudioRequestType.PlaybackNearlyFinished; + case "PlaybackFailed": + return AudioRequestType.PlaybackFailed; + default: + return AudioRequestType.Unknown; + } + } + } } } diff --git a/Alexa.NET/Request/Type/AudioRequestType.cs b/Alexa.NET/Request/Type/AudioRequestType.cs new file mode 100644 index 0000000..6e5b536 --- /dev/null +++ b/Alexa.NET/Request/Type/AudioRequestType.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Threading.Tasks; + +namespace Alexa.NET.Request.Type +{ + public enum AudioRequestType + { + [EnumMember(Value = "PlaybackStarted")] + PlaybackStarted, + [EnumMember(Value = "PlaybackFinished")] + PlaybackFinished, + [EnumMember(Value = "PlaybackStopped")] + PlaybackStopped, + [EnumMember(Value = "PlaybackNearlyFinished")] + PlaybackNearlyFinished, + [EnumMember(Value = "PlaybackFailed")] + PlaybackFailed, + [EnumMember(Value = "Unknown")] + Unknown + } +} diff --git a/Alexa.NET/Request/Type/BuiltInIntents.cs b/Alexa.NET/Request/Type/BuiltInIntents.cs new file mode 100644 index 0000000..4a46213 --- /dev/null +++ b/Alexa.NET/Request/Type/BuiltInIntents.cs @@ -0,0 +1,133 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Alexa.NET.Request.Type +{ + + public class BuiltInIntent + { + + /// + /// Purpose: + /// - Let the user cancel a transaction or task (but remain in the skill) + /// - Let the user completely exit the skill + /// + /// Common Utterances: cancel, never mind, forget it + /// + public const string Cancel = "AMAZON.CancelIntent"; + + /// + /// Purpose: + /// Provide help about how to use the skill. + /// + /// Common Utterances: help, help me, can you help me + /// + public const string Help = "AMAZON.HelpIntent"; + + /// + /// Purpose: + /// - Let the user stop an action (but remain in the skill) + /// - Let the user completely exit the skill + /// + /// Common Utterances: stop, off, shut up + /// + public const string Stop = "AMAZON.StopIntent"; + + public const string Yes = "AMAZON.YesIntent"; + + public const string No = "AMAZON.NoIntent"; + + /// + /// Audio Intents + /// - These intents are for use with a skill that plays audio + /// + /// + + /// + /// Purpose: + /// - Lets user turn on or off an audio loop + /// - can be used without the skill invocation name (ie: "Alexa, loop on") + /// + /// Common Utterances: loop off, loop on + /// + public const string LoopOff = "AMAZON.LoopOffIntent"; + + public const string LoopOn = "AMAZON.LoopOnIntent"; + + /// + /// Purpose: + /// - Lets user turn on or off shuffle mode, usually for audio skills that + /// stream a playlist of tracks + /// - can be used without the skill invocation name (ie: "Alexa, loop on") + /// + /// Common Utterances: loop off, loop on + /// + public const string ShuffleOn = "AMAZON.ShuffleOnIntent"; + + public const string ShuffleOff = "AMAZON.ShuffleOffIntent"; + + /// + /// Purpose: + /// - Let the user navigate to the next item in a list + /// - typically used for skills that stream audio + /// - can be used without the skill invocation name (ie: "Alexa, next") + /// + /// Common Utterances: next, skip, skip forward + /// + public const string Next = "AMAZON.NextIntent"; + + /// + /// Purpose: + /// - Let the user navigate to the previous item in a list + /// - typically used for skills that stream audio + /// - can be used without the skill invocation name (ie: "Alexa, go back") + /// + /// Common Utterances: go back, skip back, back up + /// + public const string Previous = "AMAZON.PreviousIntent"; + + /// + /// Purpose: + /// - Let the user pause the action in progress (such as a game or audio track) + /// - MUST be implemented for skills that stream audio + /// - can be used without the skill invocation name (ie: "Alexa, pause") + /// + /// Common Utterances: pause, pause that + /// + public const string Pause = "AMAZON.PauseIntent"; + + /// + /// Purpose: + /// - Let the user navigate repeat the last action + /// - can be used without the skill invocation name (ie: "Alexa, repeat") + /// + /// Common Utterances: repeat, say that again + /// + public const string Repeat = "AMAZON.RepeatIntent"; + + /// + /// Purpose: + /// - Let the user resume or continue an action + /// - MUST be implemented for skills that stream audio + /// - can be used without the skill invocation name (ie: "Alexa, resume ") + /// + /// Common Utterances: resume, continue, keep going + /// + public const string Resume = "AMAZON.ResumeIntent"; + + /// + /// Purpose: + /// - Let the user to restart an action, such as restarting a game, + /// transaction, or audio track. + /// - typically used for skills that stream audio + /// - can be used without the skill invocation name (ie: "Alexa, restart") + /// + /// Common Utterances: start over, restart, start again + /// + public const string StartOver = "AMAZON.StartOverIntent"; + + } + +} diff --git a/Alexa.NET/Response/Directive/ClearBehavior.cs b/Alexa.NET/Response/Directive/ClearBehavior.cs new file mode 100644 index 0000000..3e8045f --- /dev/null +++ b/Alexa.NET/Response/Directive/ClearBehavior.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Threading.Tasks; + +namespace Alexa.NET.Response.Directive +{ + public enum ClearBehavior + { + [EnumMember(Value = "CLEAR_ENQUEUED")] + ClearEnqueued, + [EnumMember(Value = "CLEAR_ALL")] + ClearAll + } +} diff --git a/Alexa.NET/Response/Directive/ClearQueueDirective.cs b/Alexa.NET/Response/Directive/ClearQueueDirective.cs new file mode 100644 index 0000000..c792179 --- /dev/null +++ b/Alexa.NET/Response/Directive/ClearQueueDirective.cs @@ -0,0 +1,20 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Alexa.NET.Response.Directive +{ + public class ClearQueueDirective : IDirective + { + [JsonProperty("type")] + public string Type => "AudioPlayer.ClearQueue"; + + [JsonProperty("clearBehavior")] + [JsonRequired] + [JsonConverter(typeof(StringEnumConverter))] + public PlayBehavior ClearBehavior { get; set; } + } +} diff --git a/Alexa.NET/ResponseBuilder.cs b/Alexa.NET/ResponseBuilder.cs index dd3d70a..25118e8 100644 --- a/Alexa.NET/ResponseBuilder.cs +++ b/Alexa.NET/ResponseBuilder.cs @@ -15,12 +15,22 @@ public static SkillResponse Tell(IOutputSpeech speechResponse) { return BuildResponse(speechResponse, true, null, null, null); } + public static SkillResponse TellWithReprompt(IOutputSpeech speechResponse, Reprompt reprompt) + { + return BuildResponse(speechResponse, true, null, reprompt, null); + } + public static SkillResponse Tell(IOutputSpeech speechResponse, Session sessionAttributes) { return BuildResponse(speechResponse, true, sessionAttributes, null, null); - } - + } + + public static SkillResponse TellWithReprompt(IOutputSpeech speechResponse, Reprompt reprompt, Session sessionAttributes) + { + return BuildResponse(speechResponse, true, sessionAttributes, reprompt, null); + } + public static SkillResponse TellWithCard(IOutputSpeech speechResponse, string title, string content) { SimpleCard card = new SimpleCard();