using Google.Api.Ads.Dfp.Lib; // Create a DfpUser object DfpUser user = new DfpUser();
using Google.Apis.Auth.OAuth2; using Google.Apis.Dfp.v202108; using Google.Apis.Dfp.v202108.Util; using Google.Api.Ads.Dfp.Lib; // Read the JSON credential file GoogleCredential credential = GoogleCredential.FromFile("credential.json") .CreateScoped(DfpService.Scope.Dfp); // Create a DfpUser object with OAuth2 credentials DfpUser user = new DfpUser(); user.Config.OAuth2Credential = credential;
using Google.Api.Ads.Dfp.v202108; // Get the LineItemService LineItemService lineItemService = (LineItemService) user.GetService(DfpService.v202108.LineItemService); // Create a Statement object to retrieve all line items Statement statement = new StatementBuilder() .OrderBy("id ASC") .Limit(500) .Offset(0) .ToStatement(); // Retrieve the line items LineItemPage page = lineItemService.getUsersByStatement(statement);In summary, the Google.Api.Ads.Dfp.Lib package library provides a DfpUser class to interact with the Ad Manager API and includes various services such as LineItemService to retrieve line items. Code examples demonstrate how to authenticate with OAuth2 credentials and retrieve all line items using the LineItemService.