Alexa.NET.Annotations 1.0.0-alpha6

This is a prerelease version of Alexa.NET.Annotations.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Alexa.NET.Annotations --version 1.0.0-alpha6                
NuGet\Install-Package Alexa.NET.Annotations -Version 1.0.0-alpha6                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Alexa.NET.Annotations" Version="1.0.0-alpha6" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Alexa.NET.Annotations --version 1.0.0-alpha6                
#r "nuget: Alexa.NET.Annotations, 1.0.0-alpha6"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Alexa.NET.Annotations as a Cake Addin
#addin nuget:?package=Alexa.NET.Annotations&version=1.0.0-alpha6&prerelease

// Install Alexa.NET.Annotations as a Cake Tool
#tool nuget:?package=Alexa.NET.Annotations&version=1.0.0-alpha6&prerelease                

Alexa.NET.Annotations

Library to help make writing your first Alexa skill smaller and easier

Creating an Alexa Skill

To create a skill, add Alexa.NET.Annotations as a NuGet reference and then you can tag a class with the AlexaSkill attribute. The big requirement is that the class has to be partial as the generator adds code to your class behind the scenes.

using Alexa.NET;
using Alexa.NET.Annotations.Markers;
using Alexa.NET.Request.Type;
using Alexa.NET.Response;

[AlexaSkill]
public partial class RockPaperScissors
{
    [Launch]
    public SkillResponse Launch(LaunchRequest intent)
    {
        return ResponseBuilder.Ask("What's your move? Rock, Paper or scissors?", new("What's your move?"));
    }

    [Intent("MakeMyMove")]
    public async Task<SkillResponse> PlayAGame(IntentRequest intentRequest)
    {
        return ResponseBuilder.Tell("You Win", null);
    }

    [Intent(BuiltInIntent.Help)]
    public SkillResponse Help(IntentRequest _) => ResponseBuilder.Empty();
}

These attributes add an Execute method to your class, which has this signature, and can be called by your code.

public virtual Task<SkillResponse> Execute(SkillRequest skillRequest);

Attributes

There are currently two attributes supported. The method name you attach these two doesn't matter and can be called anything, they're just exampes

Launch

The launch attribute is for when your skill starts, and requires a method with one of these signatures

public SkillResponse MethodName(LaunchRequest intent);
public Task<SkillResponse> Launch(LaunchRequest intent);

Intent(IntentName)

The intent attribute wires up to a specific intent, named in the attribute argument. This currently requires one of these two signatures

public async Task<SkillResponse> Intent(IntentRequest intentRequest);
public SkillResponse Intent(IntentRequest intentRequest);

Wiring up an AWS Lambda

If you plan to use an AWS Lambda project with the .NET 6 runtime, Alexa.NET.Annotations has an extra attribute you can place at the class level which will wire up the AWS Lambda straight to your skill.

[AlexaSkill]
[AlexaLambda]
public partial class RockPaperScissors
{
    ...

There are two requirements to make this work

This will generate a Program class and Main method straight to your skill pipeline.

To make this work - when you push your code to AWS Lambda, where you'd normally reference the handler in a format of [AssemblyName]::[Type]::[Method] you just put [AssemblyName]]

Here's an example of this using the AWS Lambda Upload screen in Visual Studio

AWS Lambda upload screen in visual studio showing the assembly handler attribute

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0-beta2 156 9/13/2022
1.0.0-beta1 110 9/9/2022
1.0.0-alpha9 101 9/6/2022
1.0.0-alpha7 109 8/22/2022
1.0.0-alpha6 111 8/13/2022
1.0.0-alpha5 103 8/12/2022
1.0.0-alpha4 101 8/12/2022
1.0.0-alpha3 107 8/12/2022
1.0.0-alpha2 108 8/11/2022
1.0.0-alpha1 113 8/10/2022

Initial release tidied up