后,其自身的数据将存储在报告var中
我们正试图建立一个使用谷歌广告交换卖家api的C#应用程序,但没有成功。这是使用的代码(我们将凭据保存在json文件中):
using Google.Apis.Auth.OAuth2;
using Google.Apis.Services;
using Google.Apis.Util.Store;
using Google.Apis.AdExchangeSeller.v1_1;
UserCredential credential;
using (var stream = new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read))
{
GoogleWebAuthorizationBroker.Folder = "Tasks.Auth.Store";
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(GoogleClientSecrets.Load(stream).Secrets, new[] { AdExchangeSellerService.Scope.AdexchangeSeller },
"user", CancellationToken.None, new FileDataStore("AdexchangeSeller.Auth.Store")).Result;
AdExchangeSellerService service = new AdExchangeSellerService(new AdExchangeSellerService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "Test108",
});
ReportsResource.SavedResource.ListRequest lr = service.Reports.Saved.List();
AdunitsResource.ListRequest cr = service.Adunits.List("6115701188");
}
但是,生成的变量(lr和cr)不包含任何数据。我在网上找不到任何关于如何使用这个.NET客户端库的例子,有人能告诉我我做错了什么吗?谢谢
创建请求后,您需要通过调用execute方法来执行请求:
ReportsResource.SavedResource.ListRequest lr = service.Reports.Saved.List();
Google.Apis.AdExchangeSeller.v1.Data.SavedReports reports = lr.Execute();
在执行请求