![](/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.