Google.Apis.MyBusinessAccountManagement.v1

Google.Apis.MyBusinessAccountManagement.v1

Google.Apis.MyBusinessAccountManagement.v1 .NET 客户端库自称为 v1。如果我使用它,我是否可以访问 API v4.9 端点?

如果不是...我如何将客户端库中的 GoogleCredential 与 v4.9 端点一起使用?

最终,我试图从所有 accounts/groups/locations 获得所有评论。

这是我到目前为止的位置...

if(File.Exists(ApplicationVariables.CertPath)) { 
                    GoogleCredential credential;
                    using (var stream = new FileStream(ApplicationVariables.CertPath, FileMode.Open, FileAccess.Read))
                    {
                        credential = GoogleCredential.FromStream(stream).CreateScoped("https://www.googleapis.com/auth/business.manage");
                    }

                    var service = new MyBusinessAccountManagementService(new BaseClientService.Initializer()
                        {
                            HttpClientInitializer = credential,
                            ApplicationName = "Google Reviews Downloader",
                        });

                    var accounts = await service.Accounts.List().ExecuteAsync();

                    Console.WriteLine("accounts:" + accounts);

                }

您可能不喜欢这个答案,但这里 My Business Account Management API 似乎有两个版本 v1 和 v4.9。

然而,当我们检查 Nuget.org 时,只有一个包可用 Google.Apis.MyBusinessAccountManagement.v1

这是因为包是使用 Google API 发现服务构建的 api

如果我们检查 discovery.list you will find that there is only one entry for My Business Account Management API and that is v1. This means that v4.9 is not a discovery service api and there for will not be built as part of the Google APIs .net client libary

为什么这可能是因为 Google 已经开始在 Google Cloud .net client library 下建造东西。但是我没有看到任何关于 4.9 的提及。

我认识这两个库的首席开发人员,并给他发了一封电子邮件,看看他是否知道它可能位于何处。我敢打赌它仍在开发中,尚未发布。