小编Bea*_*ase的帖子

如何使用 json 作为身份验证创建 TranslationServiceClient?

您好,感谢您阅读我的问题。

我正在努力将一些代码从 转换Google.Cloud.Translation.V2Google.Cloud.Translate.V3,因为我们需要利用 api 高级功能。我们正在使用 aTranslationClient来获取翻译(来自 V2 库),但我们需要使用(TranslationServiceClient来自 V3 库)。我在TranslationServiceClient使用我们的凭据实例化 a 时遇到问题。在 V2 中执行此操作的方法很简单:

TranslationClient.Create(GoogleCredential.FromJson("{\"the credentials\"}"));
Run Code Online (Sandbox Code Playgroud)

通过阅读文档,我清楚地知道,要创建一个TranslationServiceClient没有默认设置的文件,您需要使用 aTranslationServiceClientBuilder并提供凭据。我找不到任何示例,所有代码片段都使用TranslationServiceClient.Create()不允许任何参数的方法。

c# google-translate google-cloud-platform

2
推荐指数
1
解决办法
2605
查看次数