Google Smart Home Action 是否有 .NET 客户端库?
Is there a .NET client library for Google Smart Home Action?
我正在构建一个端点来满足 Google 智能家居操作请求。我需要在 ASP.NET Core 中构建它。有没有我可以用来包装 Google Smart Home Actions 请求的库?我只看到 Node.js 和 Java.
的库
Google Smart Home Actions libraries
目前没有用于 .NET 意图处理的实现库(尽管我们正在探索这个想法)。但是,您可以使用 Google APIs for .NET client library to communicate with the Home Graph service(用于请求同步和报告状态等功能)。
以下是 Home Graph 客户端在 C# 中的外观的简单示例:
try
{
// Create authorized client
GoogleCredential credential = GoogleCredential.FromFile("service-account.json")
.CreateScoped(new[] { "https://www.googleapis.com/auth/homegraph" });
var service = new HomeGraphServiceService(
new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "HomeGraphTester",
});
// Make Home Graph requests
var request = new RequestSyncDevicesRequest{
AgentUserId = "1234"
};
var response = service.Devices.RequestSync(request);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
我正在构建一个端点来满足 Google 智能家居操作请求。我需要在 ASP.NET Core 中构建它。有没有我可以用来包装 Google Smart Home Actions 请求的库?我只看到 Node.js 和 Java.
的库Google Smart Home Actions libraries
目前没有用于 .NET 意图处理的实现库(尽管我们正在探索这个想法)。但是,您可以使用 Google APIs for .NET client library to communicate with the Home Graph service(用于请求同步和报告状态等功能)。
以下是 Home Graph 客户端在 C# 中的外观的简单示例:
try
{
// Create authorized client
GoogleCredential credential = GoogleCredential.FromFile("service-account.json")
.CreateScoped(new[] { "https://www.googleapis.com/auth/homegraph" });
var service = new HomeGraphServiceService(
new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "HomeGraphTester",
});
// Make Home Graph requests
var request = new RequestSyncDevicesRequest{
AgentUserId = "1234"
};
var response = service.Devices.RequestSync(request);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}