简体   繁体   English

是否有用于 Google Smart Home Action 的 .NET 客户端库?

[英]Is there a .NET client library for Google Smart Home Action?

I am building an endpoint to fulfill Google Smart Home Actions requests.我正在构建一个端点来满足 Google 智能家居操作请求。 I need to build this in ASP.NET Core.我需要在 ASP.NET 核心中构建它。 Is there a library I can use to wrap Google Smart Home Actions request?有没有我可以用来包装 Google Smart Home Actions 请求的库? I am only seeing libraries for Node.js and Java.我只看到 Node.js 和 Java 的库。

Google Smart Home Actions libraries谷歌智能家居操作库

There is not currently a fulfillment library for intent handling with .NET (although we are exploring the idea).目前没有用于使用 .NET 进行意图处理的实现库(尽管我们正在探索这个想法)。 However, you can use the Google APIs for .NET client library to communicate with the Home Graph service (used for features such as Request Sync and Report State).但是,您可以使用.NET 客户端库的 Google APIHome Graph 服务(用于请求同步和报告状态等功能)进行通信。

Here is a quick example of what the Home Graph client would look like in C#:以下是 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM