forked from timheuer/alexa-skills-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request timheuer#10 from matthiasxc/playback-controller
Added PlayerController updates
- Loading branch information
Showing
13 changed files
with
177 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace Alexa.NET.Request.Type | ||
{ | ||
public class ErrorCause | ||
{ | ||
[JsonProperty("requestId")] | ||
public string requestId { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.Serialization; | ||
using System.Threading.Tasks; | ||
|
||
namespace Alexa.NET.Request.Type | ||
{ | ||
public enum ErrorType | ||
{ | ||
[EnumMember(Value = "INVALID_RESPONSE")] | ||
InvalidResponse, | ||
[EnumMember(Value = "DEVICE_COMMUNICATION_ERROR")] | ||
DeviceCommunicationError, | ||
[EnumMember(Value = "INTERNAL_ERROR")] | ||
InternalError, | ||
[EnumMember(Value = "MEDIA_ERROR_UNKNOWN")] | ||
MediaErrorUnknown, | ||
[EnumMember(Value = "MEDIA_ERROR_INVALID_REQUEST")] | ||
InvalidMediaRequest, | ||
[EnumMember(Value = "MEDIA_ERROR_SERVICE_UNAVAILABLE")] | ||
MediaServiceUnavailable, | ||
[EnumMember(Value = "MEDIA_ERROR_INTERNAL_SERVER_ERROR")] | ||
InternalServerError, | ||
[EnumMember(Value = "MEDIA_ERROR_INTERNAL_DEVICE_ERROR")] | ||
InternalDeviceError | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace Alexa.NET.Request.Type | ||
{ | ||
public class PlaybackControllerRequest : Request | ||
{ | ||
public PlaybackControllerRequestType PlaybackRequestType | ||
{ | ||
get | ||
{ | ||
switch (this.Type.Split('.')[1]) | ||
{ | ||
case "NextCommandIssued": | ||
return PlaybackControllerRequestType.Next; | ||
case "PauseCommandIssued": | ||
return PlaybackControllerRequestType.Pause; | ||
case "PlayCommandIssued": | ||
return PlaybackControllerRequestType.Play; | ||
case "PreviousCommandIssued": | ||
return PlaybackControllerRequestType.Previous; | ||
default: | ||
return PlaybackControllerRequestType.Unknown; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.Serialization; | ||
using System.Threading.Tasks; | ||
|
||
namespace Alexa.NET.Request.Type | ||
{ | ||
public enum PlaybackControllerRequestType | ||
{ | ||
[EnumMember(Value = "NextCommandIssued")] | ||
Next, | ||
[EnumMember(Value = "PauseCommandIssued")] | ||
Pause, | ||
[EnumMember(Value = "PlayCommandIssued")] | ||
Play, | ||
[EnumMember(Value = "PreviousCommandIssued")] | ||
Previous, | ||
[EnumMember(Value = "Unknown")] | ||
Unknown | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.Request.Type | ||
{ | ||
public enum Reason | ||
{ | ||
[EnumMember(Value = "USER_INITATED")] | ||
UserInitiated, | ||
[EnumMember(Value = "ERROR")] | ||
Error, | ||
[EnumMember(Value = "EXCEEDED_MAX_REPROMPTS")] | ||
ExceededMaxReprompts | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Converters; | ||
|
||
namespace Alexa.NET.Request.Type | ||
{ | ||
public class SessionEndedRequest : Request | ||
{ | ||
[JsonProperty("reason")] | ||
public string Reason { get; set; } | ||
[JsonConverter(typeof(StringEnumConverter))] | ||
public Reason Reason { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace Alexa.NET.Request.Type | ||
{ | ||
public class SystemExceptionRequest : Request | ||
{ | ||
[JsonProperty("error")] | ||
public Error Error { get; set; } | ||
[JsonProperty("cause")] | ||
public ErrorCause ErrorCause { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace Alexa.NET.Response.Directive | ||
{ | ||
public class StopDirective : IDirective | ||
{ | ||
[JsonProperty("type")] | ||
public string Type => "AudioPlayer.Stop"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters