Alexa.NET.Annotations
1.0.0-alpha6
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
<PackageReference Include="Alexa.NET.Annotations" Version="1.0.0-alpha6" />
paket add Alexa.NET.Annotations --version 1.0.0-alpha6
#r "nuget: Alexa.NET.Annotations, 1.0.0-alpha6"
// 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
- Your class must have a parameterless constructor
- You need to add a NuGet reference to https://www.nuget.org/packages/Amazon.Lambda.RuntimeSupport/
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
Product | Versions 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. |
-
.NETStandard 2.0
- Alexa.NET (>= 1.20.0)
- Alexa.NET.RequestHandlers (>= 4.2.0)
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 | 160 | 9/13/2022 |
1.0.0-beta1 | 114 | 9/9/2022 |
1.0.0-alpha9 | 105 | 9/6/2022 |
1.0.0-alpha7 | 113 | 8/22/2022 |
1.0.0-alpha6 | 115 | 8/13/2022 |
1.0.0-alpha5 | 107 | 8/12/2022 |
1.0.0-alpha4 | 105 | 8/12/2022 |
1.0.0-alpha3 | 111 | 8/12/2022 |
1.0.0-alpha2 | 112 | 8/11/2022 |
1.0.0-alpha1 | 117 | 8/10/2022 |
Initial release tidied up