Alexa.NET.APL
4.0.1
See the version list below for details.
dotnet add package Alexa.NET.APL --version 4.0.1
NuGet\Install-Package Alexa.NET.APL -Version 4.0.1
<PackageReference Include="Alexa.NET.APL" Version="4.0.1" />
paket add Alexa.NET.APL --version 4.0.1
#r "nuget: Alexa.NET.APL, 4.0.1"
// Install Alexa.NET.APL as a Cake Addin #addin nuget:?package=Alexa.NET.APL&version=4.0.1 // Install Alexa.NET.APL as a Cake Tool #tool nuget:?package=Alexa.NET.APL&version=4.0.1
Alexa.NET.APL
Small helper library to allow Alexa.NET skills to work with APL
Access to APL ViewPort Data within your skill
There are new Display
and Viewport
properties available within the request being sent to an APL enabled skill.
Rather than create a forced dependency for Alexa.NET - APL skills have an enhanced SkillRequest object with these new properties
Amazon information on Viewport information: https://developer.amazon.com/docs/alexa-presentation-language/apl-viewport-characteristics.html
Here's an example signature and opening line for a lambda function
public Task<SkillResponse> FunctionHandler(APLSkillRequest input, ILambdaContext context)
var shape = input.Context.Viewport?.Shape;
Check APL support / which version of APL is supported
skillRequest.APLSupported();
var aplDocumentVersion = skillRequest.APLInterfaceDetails().Runtime.MaxVersion;
Creating a Layout Document
Alexa.NET.APL has a set of APL components so that creating layouts is entirely within the C# object model
All properties are of Type APLValue<T>
- which allows you to specify an absolute value or an APL data binding expression for each property
new Layout(
new Container(
new Text("APL in C#") {FontSize = "24dp", TextAlign = "Center"},
new Image("https://example.com/image.jpg") {Width = 400, Height = 400}
)
{ Direction = "row"});
Adding an AlexaHeader or Footer layout
Alexa.NET.APL has support for the custom Layouts provided by the Alexa team. These need to be imported into a document before the layout can be used inside a document.
var document = new APLDocument();
document.AddResponsiveDesign();
document.MainTemplate = new Layout(
new AlexaFooter("Hint Text")
).AsMain();
Sending a RenderDocument Directove
RenderDocument hooks into the same Alexa.NET directive mechanism that already exists, you just reference the layout, document token and any data sources you want to send along with it
var shape = input.Context.Viewport?.Shape;
var response = ResponseBuilder.Tell($"Your viewport is {shape.ToString() ?? "Non existent"}");
var directive = new RenderDocumentDirective
{
Token = "randomToken",
Document = new APLDocument
{
MainTemplate = new Layout(new[]
{
new Container(new APLComponent[]{
new Text("APL in C#"){FontSize = "24dp",TextAlign= "Center"},
new Image("https://images.example.com/photos/2143/lights-party-dancing-music.jpg?cs=srgb&dl=cheerful-club-concert-2143.jpg&fm=jpg"){Width = 400,Height=400}
}){Direction = "row"}
})
}
};
response.Response.Directives.Add(directive);
Receiving SendEvent Commands from your layout
Commands are supported within Alexa.NET.APL - to send events back from your layout to your skill you need the SendEvent Command:
var wrapper = new TouchWrapper
{
OnPress = new SendEvent
{
Arguments = new Dictionary<string, object> {{"sent", true}}
}
};
To receive these events you need to add support for the UserEventRequest, which can be placed in your Lambda constructor
new UserEventRequestHandler().AddToRequestConverter();
and then you treat them like any other request type, for example
if (input.Request is UserEventRequest userEvent)
{
var token = userEvent.Token;
var argument = userEvent.Arguments["sent"];
}
Obviously your user may interact with your skill through voice means, at which point you need to be able to send commands down to your layout. This is done with the ExecuteCommands directive
using Alexa.NET.APL.Commands;
...
var sendEvent = new ExecuteCommandsDirective("token",new []
{
new SetPage
{
ComponentId="exampleId",
Value=3
}
});
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 | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.6 is compatible. netstandard2.0 was computed. 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 | tizen30 was computed. 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 1.6
- Alexa.NET (>= 1.5.4)
- NETStandard.Library (>= 1.6.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Alexa.NET.APL:
Package | Downloads |
---|---|
Ask.Sdk.Core
Core SDK package that contains the basic components and default implementations of ASK SDK for .Net Core. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.4.0 | 1,106 | 4/4/2024 |
8.3.0 | 6,287 | 1/14/2024 |
8.2.0 | 21,888 | 8/24/2023 |
8.1.0 | 3,678 | 5/29/2023 |
8.0.0 | 186 | 5/27/2023 |
7.6.3 | 2,257 | 2/8/2023 |
7.6.2 | 1,860 | 10/22/2022 |
7.6.1 | 806 | 8/15/2022 |
7.6.0 | 4,533 | 6/9/2022 |
7.5.0 | 2,126 | 12/16/2021 |
7.4.0 | 1,397 | 10/1/2021 |
7.3.0 | 1,077 | 7/21/2021 |
7.2.0 | 18,381 | 4/3/2021 |
7.1.0 | 709 | 2/17/2021 |
7.0.0 | 5,559 | 11/20/2020 |
6.1.0 | 1,177 | 9/26/2020 |
6.0.4 | 1,527 | 7/24/2020 |
6.0.3 | 610 | 7/23/2020 |
6.0.2 | 597 | 7/23/2020 |
5.1.1 | 3,251 | 3/31/2020 |
5.1.0 | 572 | 3/26/2020 |
5.0.0 | 601 | 3/26/2020 |
4.9.1 | 552 | 3/17/2020 |
4.9.0 | 812 | 1/6/2020 |
4.8.1 | 587 | 12/19/2019 |
4.8.0 | 610 | 12/5/2019 |
4.7.0 | 671 | 11/26/2019 |
4.6.0 | 957 | 11/7/2019 |
4.5.1 | 627 | 11/1/2019 |
4.4.2 | 605 | 10/30/2019 |
4.4.1 | 596 | 10/30/2019 |
4.4.0 | 600 | 10/25/2019 |
4.3.1 | 561 | 10/24/2019 |
4.3.0 | 585 | 10/24/2019 |
4.2.3 | 667 | 9/10/2019 |
4.2.1 | 582 | 9/10/2019 |
4.2.0 | 2,898 | 8/9/2019 |
4.1.2 | 656 | 8/8/2019 |
4.1.1 | 661 | 8/8/2019 |
4.1.0 | 695 | 8/7/2019 |
4.0.13 | 741 | 7/28/2019 |
4.0.12 | 678 | 7/28/2019 |
4.0.11 | 729 | 7/15/2019 |
4.0.10 | 709 | 7/14/2019 |
4.0.9 | 649 | 7/14/2019 |
4.0.8 | 644 | 7/14/2019 |
4.0.7 | 704 | 7/14/2019 |
4.0.6 | 712 | 7/11/2019 |
4.0.5 | 703 | 7/10/2019 |
4.0.4 | 697 | 7/10/2019 |
4.0.2 | 698 | 7/10/2019 |
4.0.1 | 706 | 7/7/2019 |
4.0.0 | 646 | 7/6/2019 |
3.15.0 | 734 | 5/15/2019 |
3.14.0 | 705 | 5/9/2019 |
3.13.0 | 689 | 5/5/2019 |
3.12.0 | 686 | 5/4/2019 |
3.11.0 | 1,245 | 3/27/2019 |
3.10.0 | 670 | 3/27/2019 |
3.9.0 | 647 | 3/18/2019 |
3.8.0 | 771 | 3/4/2019 |
3.7.0 | 724 | 3/3/2019 |
3.6.3 | 796 | 1/31/2019 |
3.6.2 | 815 | 1/23/2019 |
3.6.1 | 1,399 | 1/14/2019 |
3.5.0 | 820 | 1/14/2019 |
3.4.0 | 846 | 1/9/2019 |
3.3.0 | 784 | 1/9/2019 |
3.1.0 | 819 | 12/26/2018 |
3.0.0 | 749 | 12/25/2018 |
2.1.0 | 766 | 12/25/2018 |
2.0.0 | 896 | 12/13/2018 |
1.6.4 | 798 | 12/7/2018 |
1.6.3 | 1,111 | 11/11/2018 |
1.6.1 | 880 | 11/11/2018 |
1.6.0 | 790 | 11/11/2018 |
1.5.0 | 868 | 11/6/2018 |
1.4.3 | 847 | 11/6/2018 |
1.4.2 | 793 | 11/6/2018 |
1.4.1 | 800 | 11/6/2018 |
1.4.0 | 814 | 11/5/2018 |
1.3.2 | 881 | 11/5/2018 |
1.2.2 | 839 | 11/5/2018 |
1.2.1 | 870 | 11/5/2018 |
1.2.0 | 859 | 11/5/2018 |
1.1.0 | 837 | 11/4/2018 |
1.0.0 | 764 | 11/2/2018 |
Improve APLInterface support (added to readme too)
Fix issue where APLValue didn't put nullable types in Value property