微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Google.Apis.MyBusinessAccountManagement.v1

如何解决Google.Apis.MyBusinessAccountManagement.v1

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

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

最终,我试图从所有帐户/组/位置获得所有评论

这是我目前为止...

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 Discovery Service api

如果我们检查 discovery.list,您会发现 My Business Account Management API 只有一个条目,即 v1。这意味着 v4.9 不是发现服务 api,因此不会作为 Google APIs .net client libary

的一部分构建

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

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。