Alexa.NET.APL
4.1.1
See the version list below for details.
dotnet add package Alexa.NET.APL --version 4.1.1
NuGet\Install-Package Alexa.NET.APL -Version 4.1.1
<PackageReference Include="Alexa.NET.APL" Version="4.1.1" />
paket add Alexa.NET.APL --version 4.1.1
#r "nuget: Alexa.NET.APL, 4.1.1"
// Install Alexa.NET.APL as a Cake Addin #addin nuget:?package=Alexa.NET.APL&version=4.1.1 // Install Alexa.NET.APL as a Cake Tool #tool nuget:?package=Alexa.NET.APL&version=4.1.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 | 598 | 4/4/2024 |
8.3.0 | 4,132 | 1/14/2024 |
8.2.0 | 13,474 | 8/24/2023 |
8.1.0 | 2,962 | 5/29/2023 |
8.0.0 | 163 | 5/27/2023 |
7.6.3 | 2,204 | 2/8/2023 |
7.6.2 | 1,788 | 10/22/2022 |
7.6.1 | 780 | 8/15/2022 |
7.6.0 | 4,476 | 6/9/2022 |
7.5.0 | 2,097 | 12/16/2021 |
7.4.0 | 1,378 | 10/1/2021 |
7.3.0 | 1,056 | 7/21/2021 |
7.2.0 | 17,845 | 4/3/2021 |
7.1.0 | 685 | 2/17/2021 |
7.0.0 | 5,539 | 11/20/2020 |
6.1.0 | 1,154 | 9/26/2020 |
6.0.4 | 1,495 | 7/24/2020 |
6.0.3 | 564 | 7/23/2020 |
6.0.2 | 569 | 7/23/2020 |
5.1.1 | 3,153 | 3/31/2020 |
5.1.0 | 553 | 3/26/2020 |
5.0.0 | 577 | 3/26/2020 |
4.9.1 | 531 | 3/17/2020 |
4.9.0 | 787 | 1/6/2020 |
4.8.1 | 563 | 12/19/2019 |
4.8.0 | 587 | 12/5/2019 |
4.7.0 | 649 | 11/26/2019 |
4.6.0 | 933 | 11/7/2019 |
4.5.1 | 608 | 11/1/2019 |
4.4.2 | 585 | 10/30/2019 |
4.4.1 | 573 | 10/30/2019 |
4.4.0 | 578 | 10/25/2019 |
4.3.1 | 541 | 10/24/2019 |
4.3.0 | 563 | 10/24/2019 |
4.2.3 | 648 | 9/10/2019 |
4.2.1 | 557 | 9/10/2019 |
4.2.0 | 2,880 | 8/9/2019 |
4.1.2 | 632 | 8/8/2019 |
4.1.1 | 636 | 8/8/2019 |
4.1.0 | 673 | 8/7/2019 |
4.0.13 | 720 | 7/28/2019 |
4.0.12 | 658 | 7/28/2019 |
4.0.11 | 707 | 7/15/2019 |
4.0.10 | 674 | 7/14/2019 |
4.0.9 | 621 | 7/14/2019 |
4.0.8 | 624 | 7/14/2019 |
4.0.7 | 685 | 7/14/2019 |
4.0.6 | 687 | 7/11/2019 |
4.0.5 | 679 | 7/10/2019 |
4.0.4 | 676 | 7/10/2019 |
4.0.2 | 673 | 7/10/2019 |
4.0.1 | 688 | 7/7/2019 |
4.0.0 | 625 | 7/6/2019 |
3.15.0 | 707 | 5/15/2019 |
3.14.0 | 685 | 5/9/2019 |
3.13.0 | 665 | 5/5/2019 |
3.12.0 | 665 | 5/4/2019 |
3.11.0 | 1,195 | 3/27/2019 |
3.10.0 | 651 | 3/27/2019 |
3.9.0 | 628 | 3/18/2019 |
3.8.0 | 744 | 3/4/2019 |
3.7.0 | 687 | 3/3/2019 |
3.6.3 | 772 | 1/31/2019 |
3.6.2 | 807 | 1/23/2019 |
3.6.1 | 1,372 | 1/14/2019 |
3.5.0 | 798 | 1/14/2019 |
3.4.0 | 826 | 1/9/2019 |
3.3.0 | 775 | 1/9/2019 |
3.1.0 | 796 | 12/26/2018 |
3.0.0 | 727 | 12/25/2018 |
2.1.0 | 739 | 12/25/2018 |
2.0.0 | 867 | 12/13/2018 |
1.6.4 | 776 | 12/7/2018 |
1.6.3 | 1,087 | 11/11/2018 |
1.6.1 | 860 | 11/11/2018 |
1.6.0 | 765 | 11/11/2018 |
1.5.0 | 846 | 11/6/2018 |
1.4.3 | 825 | 11/6/2018 |
1.4.2 | 786 | 11/6/2018 |
1.4.1 | 777 | 11/6/2018 |
1.4.0 | 794 | 11/5/2018 |
1.3.2 | 852 | 11/5/2018 |
1.2.2 | 817 | 11/5/2018 |
1.2.1 | 863 | 11/5/2018 |
1.2.0 | 820 | 11/5/2018 |
1.1.0 | 819 | 11/4/2018 |
1.0.0 | 757 | 11/2/2018 |
Fix dimension binding (thanks for spotting George!)
Fix video component source property