【发布时间】:2021-10-20 22:28:50
【问题描述】:
目前,我正在开发一种 Alexa 技能,可以从 DevOps 返回工作项。为此,我使用 Aws Toolkit for Visual Studio。
现在我想知道是否可以包含来自我们 DevOps 组织的 NuGet 包。
基本上是这样的:
using Amazon.Lambda.Core;
using Newtonsoft.Json;
using Slight.Alexa.Framework.Models.Requests;
using Slight.Alexa.Framework.Models.Responses;
// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class.
[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))]
namespace AlexaDevOpsSkill
{
public class Function
{
/// <summary>
/// Searches for a work item.
/// </summary>
/// <param name="input"></param>
/// <param name="context"></param>
/// <returns></returns>
public string FunctionHandler(SkillRequest input, ILambdaContext context)
{
IOutputSpeech outputSpeech = null;
if (input.Request.Intent.Name == "SearchIntent")
{
MyNuGetPackage.DevOpsItem devOpsItem = MyNuGetPackage.GetWorkItem(input.Request.Intent.Slots["Id"]);
outputSpeech = new PlainTextOutputSpeech() { Text = $"I found the workitem: {devOpsItem.Name}" };
}
Response response = new Response() { OutputSpeech = outputSpeech };
SkillResponse skillResponse = new SkillResponse() { Response = response };
return JsonConvert.SerializeObject(skillResponse);
}
}
}
我知道,有一个 NuGet 包允许我在 nuget.org 上搜索工作项,但我希望有一天能包含来自不同 NuGet 包的其他功能。这只是我当前的示例。
从其他来源安装 Nuget 包时,我什至无法在 function.cs 文档中引用它。
如果这不适用于 AWS,我可以在 DevOps 上托管我的函数以供 Alexa 使用吗?
【问题讨论】:
标签: c# aws-lambda alexa