![](/img/trans.png)
[英]How to pass the Client Id for google authetication in .Net Core 6
[英]Is there a .NET client library for Google Smart Home Action?
我正在构建一个端点来满足 Google 智能家居操作请求。 我需要在 ASP.NET 核心中构建它。 有没有我可以用来包装 Google Smart Home Actions 请求的库? 我只看到 Node.js 和 Java 的库。
目前没有用于使用 .NET 进行意图处理的实现库(尽管我们正在探索这个想法)。 但是,您可以使用.NET 客户端库的 Google API与Home Graph 服务(用于请求同步和报告状态等功能)进行通信。
以下是 C# 中 Home Graph 客户端外观的快速示例:
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);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.