Skip to content

Commit

Permalink
Add support for AudioPlay.Play directive
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasviehweger committed Dec 29, 2016
1 parent d304947 commit 6c7a2ab
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Alexa.NET/Response/Directive/AudioItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Newtonsoft.Json;

namespace Alexa.NET.Response.Directive
{
public class AudioItem
{
[JsonRequired]
[JsonProperty("stream")]
public AudioItemStream Stream { get; set; }
}
}
23 changes: 23 additions & 0 deletions Alexa.NET/Response/Directive/AudioItemStream.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Newtonsoft.Json;

namespace Alexa.NET.Response.Directive
{
public class AudioItemStream
{
[JsonRequired]
[JsonProperty("url")]
public string Url { get; set; }

[JsonRequired]
[JsonProperty("token")]
public string Token { get; set; }

[JsonRequired]
[JsonProperty("expectedPreviousToken")]
public string ExpectedPreviousToken { get; set; }

[JsonRequired]
[JsonProperty("offsetInMilliseconds")]
public int OffsetInMilliseconds { get; set; }
}
}
20 changes: 20 additions & 0 deletions Alexa.NET/Response/Directive/AudioPlayerPlayDirective.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace Alexa.NET.Response.Directive
{
public class AudioPlayerDirective : IDirective
{
[JsonProperty("playBehavior")]
[JsonRequired]
[JsonConverter(typeof(StringEnumConverter))]
public PlayBehavior PlayBehavior { get; set; }

[JsonProperty("audioItem")]
[JsonRequired]
public AudioItem AudioPlayerAudioItem { get; set; }

[JsonProperty("type")]
public string Type => "AudioPlayer.Play";
}
}
18 changes: 18 additions & 0 deletions Alexa.NET/Response/Directive/PlayBehavior.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading.Tasks;

namespace Alexa.NET.Response.Directive
{
public enum PlayBehavior
{
[EnumMember(Value = "REPLACE_ALL")]
ReplaceAll,
[EnumMember(Value = "ENQUEUE")]
Enqueue,
[EnumMember(Value = "REPLACE_ENQUEUED")]
ReplaceEnqueued
}
}

0 comments on commit 6c7a2ab

Please sign in to comment.