diff --git a/PortlandiaQuotes/AlexaResponse.cs b/PortlandiaQuotes/AlexaResponse.cs new file mode 100644 index 0000000..2d43835 --- /dev/null +++ b/PortlandiaQuotes/AlexaResponse.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using AlexaSkillsKit.Authentication; +using AlexaSkillsKit.Json; +using AlexaSkillsKit.Speechlet; +using AlexaSkillsKit.UI; + +namespace PortlandiaQuotes +{ + public class AlexaResponse : Speechlet + { + + + public override SpeechletResponse OnIntent(IntentRequest intentRequest, Session session) + { + return CompileResponse(); + } + + public override SpeechletResponse OnLaunch(LaunchRequest launchRequest, Session session) + { + return CompileResponse(); + } + + public override bool OnRequestValidation(SpeechletRequestValidationResult result, DateTime referenceTimeUtc, SpeechletRequestEnvelope requestEnvelope) + { + if(requestEnvelope?.Session?.Application?.Id?.Equals("amzn1.ask.skill.052afe5d-6417-4e89-b6aa-b4ee3c0bb75a") == false) + { + return false; + } + return base.OnRequestValidation(result, referenceTimeUtc, requestEnvelope); + } + + public override void OnSessionEnded(SessionEndedRequest sessionEndedRequest, Session session) + { + } + + public override void OnSessionStarted(SessionStartedRequest sessionStartedRequest, Session session) + { + } + public static SpeechletResponse CompileResponse() + { + var excuse = GetExcuse(); + return new SpeechletResponse() + { + OutputSpeech = new PlainTextOutputSpeech() { Text = excuse }, + ShouldEndSession = true + }; + } + public static string GetExcuse() + { + // Setup the configuration to support document loading + var item = new Random().Next(0, Items.ItemsList.Count); + return Items.ItemsList[item]; + } + } +} \ No newline at end of file diff --git a/PortlandiaQuotes/ApplicationInsights.config b/PortlandiaQuotes/ApplicationInsights.config new file mode 100644 index 0000000..ec4db4e --- /dev/null +++ b/PortlandiaQuotes/ApplicationInsights.config @@ -0,0 +1,87 @@ + + + aab4afe8-322d-48a7-8552-579e6be7ad1d + + + + + + + + + + + + + System.Web.Handlers.TransferRequestHandler + Microsoft.VisualStudio.Web.PageInspector.Runtime.Tracing.RequestDataHttpHandler + System.Web.StaticFileHandler + System.Web.Handlers.AssemblyResourceLoader + System.Web.Optimization.BundleHandler + System.Web.Script.Services.ScriptHandlerFactory + System.Web.Handlers.TraceHandler + System.Web.Services.Discovery.DiscoveryRequestHandler + System.Web.HttpDebugHandler + + + + + + + + 5 + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PortlandiaQuotes/Controllers/AlexaController.cs b/PortlandiaQuotes/Controllers/AlexaController.cs new file mode 100644 index 0000000..4d6f727 --- /dev/null +++ b/PortlandiaQuotes/Controllers/AlexaController.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Web.Http; + +namespace PortlandiaQuotes.Controllers +{ + + public class AlexaController : ApiController + { + [Route("")] + [HttpGet] + [HttpHead] + public IHttpActionResult root() + { + return this.Ok($"Yo, {Items.ItemsList.Count} items"); + } + [Route("")] + [HttpPost] + public HttpResponseMessage Post() + { + return new AlexaResponse().GetResponse(this.Request); + } + [Route("excuse")] + [HttpGet] + public string GetExcuse() + { + return AlexaResponse.GetExcuse(); + } + } +} diff --git a/PortlandiaQuotes/Controllers/ValuesController.cs b/PortlandiaQuotes/Controllers/ValuesController.cs deleted file mode 100644 index 23f7077..0000000 --- a/PortlandiaQuotes/Controllers/ValuesController.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Web.Http; - -namespace PortlandiaQuotes.Controllers -{ - public class ValuesController : ApiController - { - // GET api/values - public IEnumerable Get() - { - return new string[] { "value1", "value2" }; - } - - // GET api/values/5 - public string Get(int id) - { - return "value"; - } - - // POST api/values - public void Post([FromBody]string value) - { - } - - // PUT api/values/5 - public void Put(int id, [FromBody]string value) - { - } - - // DELETE api/values/5 - public void Delete(int id) - { - } - } -} diff --git a/PortlandiaQuotes/Items.cs b/PortlandiaQuotes/Items.cs new file mode 100644 index 0000000..7e4abf9 --- /dev/null +++ b/PortlandiaQuotes/Items.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; + +namespace PortlandiaQuotes +{ + public static class Items + { + //not normally thread safe, but multiple reads are ok, just no writes + public static List ItemsList = new List() + { + "put a bird on it", + "im totally on coke", + "Cacao, Cacao ", + "Oww watch your fingernails", + "My vacation day starts now.", + "It's one-time fee you pay annually", + "we can pickle that", + "Whole foods is corporate!", + "Shell art is OVER", + "Cheese boats are dope", + "I'm the pull out king", + "The Dream of the 90s is Alive in Portland.", + "People tell me my body looks like a melted candle", + "For just $1 you get a half price download of half of the song. You'll be able to listen to it just once", + "Hi! Welcome to 'Women and Women First", + "Is this a CD minus r or CD plus r", + "What a sad little tote bag.... I know. Put a bird on it", + "Hey, come play air guitar with us. It's all good", + "Darby's had a cold for about 5 years", + "who puts their dog on a pole like a stripper?", + "Explain yourself, in a silent voice, with words.", + "One vegan bacon cheeseburger, two vegan bacon cheeseburger." + + }; + } +} \ No newline at end of file diff --git a/PortlandiaQuotes/PortlandiaQuotes.csproj b/PortlandiaQuotes/PortlandiaQuotes.csproj index d338bf9..52cb117 100644 --- a/PortlandiaQuotes/PortlandiaQuotes.csproj +++ b/PortlandiaQuotes/PortlandiaQuotes.csproj @@ -12,13 +12,15 @@ Properties PortlandiaQuotes PortlandiaQuotes - v4.5.2 + v4.6.2 true + /subscriptions/6332a4fe-3d5b-4857-9206-6dedd406f451/resourcegroups/Default-ApplicationInsights-EastUS/providers/microsoft.insights/components/PortlandiaQuotes + true @@ -38,72 +40,121 @@ 4 + + ..\packages\AlexaSkillsKit.NET.1.5.1\lib\net45\AlexaSkillsKit.dll + True + + + ..\packages\BouncyCastle.1.8.1\lib\BouncyCastle.Crypto.dll + True + + + ..\packages\Microsoft.ApplicationInsights.Agent.Intercept.1.2.1\lib\net45\Microsoft.AI.Agent.Intercept.dll + True + + + ..\packages\Microsoft.ApplicationInsights.DependencyCollector.2.1.0\lib\net45\Microsoft.AI.DependencyCollector.dll + True + + + ..\packages\Microsoft.ApplicationInsights.PerfCounterCollector.2.1.0\lib\net45\Microsoft.AI.PerfCounterCollector.dll + True + + + ..\packages\Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.2.1.0\lib\net45\Microsoft.AI.ServerTelemetryChannel.dll + True + + + ..\packages\Microsoft.ApplicationInsights.Web.2.1.0\lib\net45\Microsoft.AI.Web.dll + True + + + ..\packages\Microsoft.ApplicationInsights.WindowsServer.2.1.0\lib\net45\Microsoft.AI.WindowsServer.dll + True + + + ..\packages\Microsoft.ApplicationInsights.2.1.0\lib\net46\Microsoft.ApplicationInsights.dll + True + - True ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll + True - + + ..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll + True + + ..\packages\Swashbuckle.Core.5.0.0\lib\net40\Swashbuckle.Core.dll + True - + + ..\packages\System.IdentityModel.Tokens.Jwt.4.0.0\lib\net45\System.IdentityModel.Tokens.Jwt.dll + True + + ..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll + True + - - - + + ..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll + True + + + ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll + True + + + ..\packages\WebActivatorEx.2.0.6\lib\net40\WebActivatorEx.dll + True + - - ..\packages\WebActivatorEx.2.0.6\lib\net40\WebActivatorEx.dll - - - ..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll - - - ..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll - - - ..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll - - - ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll - + + + PreserveNewest + + - + Global.asax + + + Web.config @@ -111,7 +162,9 @@ Web.config - + + + 10.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) diff --git a/PortlandiaQuotes/Properties/PublishProfiles/PortlandiaQuotes.pubxml b/PortlandiaQuotes/Properties/PublishProfiles/PortlandiaQuotes.pubxml new file mode 100644 index 0000000..fca8907 --- /dev/null +++ b/PortlandiaQuotes/Properties/PublishProfiles/PortlandiaQuotes.pubxml @@ -0,0 +1,25 @@ + + + + + MSDeploy + AzureWebSite + Release + Any CPU + http://portlandiaquotes.azurewebsites.net + True + False + portlandiaquotes.scm.azurewebsites.net:443 + PortlandiaQuotes + + True + WMSVC + True + $PortlandiaQuotes + <_SavePWD>True + <_DestinationType>AzureWebSite + + \ No newline at end of file diff --git a/PortlandiaQuotes/Service References/Application Insights/ConnectedService.json b/PortlandiaQuotes/Service References/Application Insights/ConnectedService.json new file mode 100644 index 0000000..1ed737b --- /dev/null +++ b/PortlandiaQuotes/Service References/Application Insights/ConnectedService.json @@ -0,0 +1,7 @@ +{ + "ProviderId": "Microsoft.ApplicationInsights.ConnectedService.ConnectedServiceProvider", + "Version": "7.14.1128.2", + "GettingStartedDocument": { + "Uri": "https://go.microsoft.com/fwlink/?LinkID=613413" + } +} \ No newline at end of file diff --git a/PortlandiaQuotes/Web.config b/PortlandiaQuotes/Web.config index 9b973f7..76c7e70 100644 --- a/PortlandiaQuotes/Web.config +++ b/PortlandiaQuotes/Web.config @@ -4,25 +4,40 @@ http://go.microsoft.com/fwlink/?LinkId=301879 --> - - + + - - + + + + + - + + + + + + + - - + - + @@ -34,4 +49,4 @@ - + \ No newline at end of file diff --git a/PortlandiaQuotes/packages.config b/PortlandiaQuotes/packages.config index 0cc51ec..4977690 100644 --- a/PortlandiaQuotes/packages.config +++ b/PortlandiaQuotes/packages.config @@ -1,13 +1,22 @@  - - - - - - - - - - + + + + + + + + + + + + + + + + + + + \ No newline at end of file