本文整理汇总了C#中Google.Api.Ads.Dfp.Util.v201403.StatementBuilder类的典型用法代码示例。如果您正苦于以下问题:C# StatementBuilder类的具体用法?C# StatementBuilder怎么用?C# StatementBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StatementBuilder类属于Google.Api.Ads.Dfp.Util.v201403命名空间,在下文中一共展示了StatementBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(DfpUser user) {
// Get the PublisherQueryLanguageService.
PublisherQueryLanguageService pqlService =
(PublisherQueryLanguageService) user.GetService(
DfpService.v201403.PublisherQueryLanguageService);
try {
StatementBuilder lineItemStatementBuilder = new StatementBuilder()
.Select("Id, Name, Status")
.From("Line_Item")
.OrderBy("Id ASC")
.Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
string lineItemFilePath = "Line-Item-Matchtable.csv";
fetchMatchTables(pqlService, lineItemStatementBuilder, lineItemFilePath);
StatementBuilder adUnitStatementBuilder = new StatementBuilder()
.Select("Id, Name")
.From("Ad_Unit")
.OrderBy("Id ASC")
.Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
string adUnitFilePath = "Ad-Unit-Matchtable.csv";
fetchMatchTables(pqlService, adUnitStatementBuilder, adUnitFilePath);
Console.WriteLine("Ad units saved to %s", adUnitFilePath);
Console.WriteLine("Line items saved to %s\n", lineItemFilePath);
} catch (Exception ex) {
Console.WriteLine("Failed to get match tables. Exception says \"{0}\"", ex.Message);
}
}
开发者ID:GerryT01,项目名称:googleads-dotnet-lib,代码行数:33,代码来源:FetchMatchTables.cs
示例2: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(DfpUser user) {
// Get the InventoryService.
InventoryService inventoryService =
(InventoryService) user.GetService(DfpService.v201403.InventoryService);
StatementBuilder statementBuilder = new StatementBuilder()
.Where("targetPlatform = :targetPlatform")
.AddValue("targetPlatform", "WEB");
try {
// Get all ad unit sizes.
AdUnitSize[] adUnitSizes = inventoryService.getAdUnitSizesByStatement(
statementBuilder.ToStatement());
// Display results.
if (adUnitSizes != null) {
for (int i = 0; i < adUnitSizes.Length; i++) {
AdUnitSize adUnitSize = adUnitSizes[i];
Console.WriteLine("{0}) Ad unit size ({1}x{2}) was found.\n", i,
adUnitSize.size.width, adUnitSize.size.height);
}
} else {
Console.WriteLine("No ad unit sizes found.");
}
} catch (Exception ex) {
Console.WriteLine("Failed to get ad unit sizes. Exception says \"{0}\"", ex.Message);
}
}
开发者ID:hoodapecan,项目名称:googleads-dotnet-lib,代码行数:32,代码来源:GetAdUnitSizes.cs
示例3: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(DfpUser user) {
// Get the ActivityGroupService.
ActivityGroupService activityGroupService =
(ActivityGroupService) user.GetService(DfpService.v201403.ActivityGroupService);
StatementBuilder statementBuilder = new StatementBuilder()
.Where("status = :status")
.OrderBy("id ASC")
.Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.AddValue("status", ActivityGroupStatus.ACTIVE.ToString());
// Set default for page.
ActivityGroupPage page;
try {
do {
// Get contacts by statement.
page = activityGroupService.getActivityGroupsByStatement(statementBuilder.ToStatement());
if (page.results != null) {
int i = page.startIndex;
foreach (ActivityGroup activityGroup in page.results) {
Console.WriteLine("{0}) Activity group with ID \"{1}\" and name \"{2}\" was found.",
i, activityGroup.id, activityGroup.name);
i++;
}
}
statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.GetOffset() < page.totalResultSetSize);
Console.WriteLine("Number of results found: " + page.totalResultSetSize);
} catch (Exception ex) {
Console.WriteLine("Failed to get activity groups. Exception says \"{0}\"", ex.Message);
}
}
开发者ID:GerryT01,项目名称:googleads-dotnet-lib,代码行数:39,代码来源:GetActiveActivityGroups.cs
示例4: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(DfpUser user) {
// Get the ContentService.
ContentService contentService =
(ContentService) user.GetService(DfpService.v201403.ContentService);
// Create a statement to get all content.
StatementBuilder statementBuilder = new StatementBuilder()
.OrderBy("id ASC")
.Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
// Set default for page.
ContentPage page = new ContentPage();
try {
do {
// Get content by statement.
page = contentService.getContentByStatement(statementBuilder.ToStatement());
if (page.results != null) {
int i = page.startIndex;
foreach (Content content in page.results) {
Console.WriteLine("{0}) Content with ID \"{1}\", name \"{2}\", and status \"{3}\" " +
"was found.", i, content.id, content.name, content.status);
i++;
}
}
statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.GetOffset() < page.totalResultSetSize);
Console.WriteLine("Number of results found: " + page.totalResultSetSize);
} catch (Exception ex) {
Console.WriteLine("Failed to get all content. Exception says \"{0}\"", ex.Message);
}
}
开发者ID:GerryT01,项目名称:googleads-dotnet-lib,代码行数:38,代码来源:GetAllContent.cs
示例5: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(DfpUser user) {
// Get the ActivityService.
ActivityService activityService =
(ActivityService) user.GetService(DfpService.v201403.ActivityService);
// Set the ID of the activity to update.
int activityId = int.Parse(_T("INSERT_ACTIVITY_ID_HERE"));
try {
// Get the activity.
StatementBuilder statemetnBuilder = new StatementBuilder()
.Where("id = :id")
.OrderBy("id ASC")
.Limit(1)
.AddValue("id", activityId);
ActivityPage page = activityService.getActivitiesByStatement(
statemetnBuilder.ToStatement());
Activity activity = page.results[0];
// Update the expected URL.
activity.expectedURL = "https://www.google.com";
// Update the activity on the server.
Activity[] activities = activityService.updateActivities(new Activity[] {activity});
foreach (Activity updatedActivity in activities) {
Console.WriteLine("Activity with ID \"{0}\" and name \"{1}\" was updated.",
updatedActivity.id, updatedActivity.name);
}
} catch (Exception ex) {
Console.WriteLine("Failed to update activities. Exception says \"{0}\"", ex.Message);
}
}
开发者ID:GerryT01,项目名称:googleads-dotnet-lib,代码行数:38,代码来源:UpdateActivities.cs
示例6: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(DfpUser user)
{
// Get the CreativeTemplateService.
CreativeTemplateService creativeTemplateService =
(CreativeTemplateService) user.GetService(DfpService.v201403.CreativeTemplateService);
// Create a statement to only select system defined creative templates.
Statement filterStatement =
new StatementBuilder("WHERE type = :creativeTemplateType LIMIT 500").AddValue(
"creativeTemplateType", CreativeTemplateType.SYSTEM_DEFINED.ToString()).ToStatement();
try {
// Get creative templates by statement.
CreativeTemplatePage page = creativeTemplateService.getCreativeTemplatesByStatement(
filterStatement);
if (page.results != null) {
int i = page.startIndex;
foreach (CreativeTemplate creativeTemplate in page.results) {
Console.WriteLine("{0}) Creative template with ID \"{1}\", name \"{2}\", and type " +
"\"{3}\" was found.", i, creativeTemplate.id, creativeTemplate.name,
creativeTemplate.type);
i++;
}
}
Console.WriteLine("Number of results found: " + page.totalResultSetSize);
} catch (Exception ex) {
Console.WriteLine("Failed to get creative templates. Exception says \"{0}\"",
ex.Message);
}
}
开发者ID:hassanasd,项目名称:googleads-dfp-dotnet-lib,代码行数:35,代码来源:GetCreativeTemplatesByStatement.cs
示例7: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(DfpUser user) {
// Get the CompanyService.
CompanyService companyService =
(CompanyService) user.GetService(DfpService.v201403.CompanyService);
// Set the ID of the company to update.
int companyId = int.Parse(_T("INSERT_COMPANY_ID_HERE"));
// Create a Statement to select the company by ID.
StatementBuilder statementBuilder = new StatementBuilder()
.Where("id = :companyId")
.OrderBy("id ASC")
.Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.AddValue("id", companyId);
try {
// Get the companies by Statement.
CompanyPage page = companyService.getCompaniesByStatement(statementBuilder.ToStatement());
Company company = page.results[0];
// Update the company comment
company.comment = company.comment + " Updated.";
// Update the company on the server.
Company[] companies = companyService.updateCompanies(new Company[] {company});
foreach (Company updatedCompany in companies) {
Console.WriteLine("Company with ID = {0}, name = {1}, and comment \"{2}\" was updated",
updatedCompany.id, updatedCompany.name, updatedCompany.comment);
}
} catch (Exception ex) {
Console.WriteLine("Failed to update companies. Exception says \"{0}\"", ex.Message);
}
}
开发者ID:GerryT01,项目名称:googleads-dotnet-lib,代码行数:39,代码来源:UpdateCompanies.cs
示例8: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(DfpUser user)
{
// Get the TeamService.
TeamService teamService = (TeamService) user.GetService(DfpService.v201403.TeamService);
// Create a statement to order teams by name.
Statement filterStatement = new StatementBuilder("ORDER BY name LIMIT 500").ToStatement();
try {
// Get teams by statement.
TeamPage page = teamService.getTeamsByStatement(filterStatement);
// Display results.
if (page.results != null) {
int i = page.startIndex;
foreach (Team team in page.results) {
Console.WriteLine("{0}) Team with ID \"{1}\" and name \"{2}\" was found.",
i, team.id, team.name);
i++;
}
}
Console.WriteLine("Number of results found: " + page.totalResultSetSize);
} catch (Exception ex) {
Console.WriteLine("Failed to get teams by statement. Exception says \"{0}\"", ex.Message);
}
}
开发者ID:hassanasd,项目名称:googleads-dfp-dotnet-lib,代码行数:31,代码来源:GetTeamsByStatement.cs
示例9: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(DfpUser user) {
// Get the ContactService.
ContactService contactService =
(ContactService) user.GetService(DfpService.v201403.ContactService);
// Set the ID of the contact to update.
long contactId = long.Parse(_T("INSERT_CONTACT_ID_HERE"));
try {
StatementBuilder statementBuilder = new StatementBuilder()
.Where("id = :id")
.OrderBy("id ASC")
.Limit(1)
.AddValue("id", contactId);
// Get the contact.
ContactPage page = contactService.getContactsByStatement(statementBuilder.ToStatement());
Contact contact = page.results[0];
// Update the address of the contact.
contact.address = "123 New Street, New York, NY, 10011";
// Update the contact on the server.
Contact[] contacts = contactService.updateContacts(new Contact[] {contact});
// Display results.
foreach (Contact updatedContact in contacts) {
Console.WriteLine("Contact with ID \"{0}\", name \"{1}\", and comment \"{2}\" was " +
"updated.", updatedContact.id, updatedContact.name, updatedContact.comment);
}
} catch (Exception ex) {
Console.WriteLine("Failed to update contacts. Exception says \"{0}\"", ex.Message);
}
}
开发者ID:hoodapecan,项目名称:googleads-dotnet-lib,代码行数:38,代码来源:UpdateContacts.cs
示例10: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(DfpUser user) {
// Create the CreativeWrapperService.
CreativeWrapperService creativeWrapperService = (CreativeWrapperService) user.GetService(
DfpService.v201403.CreativeWrapperService);
long creativeWrapperId = long.Parse(_T("INSERT_CREATIVE_WRAPPER_ID_HERE"));
try {
StatementBuilder statementBuilder = new StatementBuilder()
.Where("id = :id")
.OrderBy("id ASC")
.Limit(1)
.AddValue("id", creativeWrapperId);
CreativeWrapperPage page = creativeWrapperService.getCreativeWrappersByStatement(
statementBuilder.ToStatement());
CreativeWrapper wrapper = page.results[0];
wrapper.ordering = CreativeWrapperOrdering.OUTER;
// Update the creative wrappers on the server.
CreativeWrapper[] creativeWrappers = creativeWrapperService.updateCreativeWrappers(
new CreativeWrapper[] {wrapper});
// Display results.
foreach (CreativeWrapper createdCreativeWrapper in creativeWrappers) {
Console.WriteLine("Creative wrapper with ID '{0}' and wrapping order '{1}' was " +
"updated.", createdCreativeWrapper.id, createdCreativeWrapper.ordering);
}
} catch (Exception ex) {
Console.WriteLine("Failed to update creative wrappers. Exception says \"{0}\"",
ex.Message);
}
}
开发者ID:GerryT01,项目名称:googleads-dotnet-lib,代码行数:36,代码来源:UpdateCreativeWrappers.cs
示例11: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(DfpUser user) {
// Get the CreativeService.
CreativeService creativeService =
(CreativeService) user.GetService(DfpService.v201403.CreativeService);
// Create a Statement to get all creatives.
StatementBuilder statementBuilder = new StatementBuilder()
.OrderBy("id ASC")
.Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
// Set default for page.
CreativePage page = new CreativePage();
try {
do {
// Get creatives by Statement.
page = creativeService.getCreativesByStatement(statementBuilder.ToStatement());
if (page.results != null && page.results.Length > 0) {
int i = page.startIndex;
foreach (Creative creative in page.results) {
Console.WriteLine("{0}) Creative with ID ='{1}', name ='{2}' and type ='{3}' " +
"was found.", i, creative.id, creative.name, creative.CreativeType);
i++;
}
}
statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.GetOffset() < page.totalResultSetSize);
Console.WriteLine("Number of results found: {0}", page.totalResultSetSize);
} catch (Exception ex) {
Console.WriteLine("Failed to get all creatives. Exception says \"{0}\"", ex.Message);
}
}
开发者ID:GerryT01,项目名称:googleads-dotnet-lib,代码行数:39,代码来源:GetAllCreatives.cs
示例12: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(DfpUser user) {
// Get the ActivityService.
ActivityService activityService =
(ActivityService) user.GetService(DfpService.v201403.ActivityService);
int totalResultsCounter = 0;
try {
StatementBuilder statementBuilder = new StatementBuilder()
.OrderBy("id ASC")
.Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
ActivityPage page = new ActivityPage();
do {
// Get activities by statement.
page = activityService.getActivitiesByStatement(statementBuilder.ToStatement());
// Display results.
if (page.results != null) {
foreach (Activity activity in page.results) {
Console.WriteLine("{0}) Activity with ID \"{1}\", name \"{2}\" and type \"{3}\" " +
"was found.\n", totalResultsCounter, activity.id, activity.name,
activity.type);
totalResultsCounter++;
}
}
statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.GetOffset() < page.totalResultSetSize);
Console.WriteLine("Number of results found: {0}.", totalResultsCounter);
} catch (Exception ex) {
Console.WriteLine("Failed to get contacts. Exception says \"{0}\"", ex.Message);
}
}
开发者ID:hoodapecan,项目名称:googleads-dotnet-lib,代码行数:38,代码来源:GetAllActivities.cs
示例13: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(DfpUser user)
{
// Get the CreativeService.
CustomTargetingService customTargetingService =
(CustomTargetingService) user.GetService(DfpService.v201403.CustomTargetingService);
try {
// Create a statement to only select predefined custom targeting keys.
Statement filterStatement = new StatementBuilder("WHERE type = :type LIMIT 500").AddValue(
"type", CustomTargetingKeyType.PREDEFINED.ToString()).ToStatement();
// Get custom targeting keys by statement.
CustomTargetingKeyPage page =
customTargetingService.getCustomTargetingKeysByStatement(filterStatement);
if (page.results != null) {
int i = page.startIndex;
foreach (CustomTargetingKey customTargetingKey in page.results) {
Console.WriteLine("{0}) Custom targeting key with ID \"{1}\", name \"{2}\", and " +
"display name \"{3}\" was found.", i, customTargetingKey.id,
customTargetingKey.name, customTargetingKey.displayName);
i++;
}
}
Console.WriteLine("Number of results found: {0}", page.totalResultSetSize);
} catch (Exception ex) {
Console.WriteLine("Failed to get predefined custom targeting keys. Exception " +
"says \"{0}\"", ex.Message);
}
}
开发者ID:hassanasd,项目名称:googleads-dfp-dotnet-lib,代码行数:34,代码来源:GetCustomTargetingKeysByStatement.cs
示例14: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(DfpUser user)
{
// Get the ActivityService.
ActivityService activityService =
(ActivityService) user.GetService(DfpService.v201403.ActivityService);
int totalResultsCounter = 0;
try {
Statement filterStatement = new StatementBuilder("").ToStatement();
ActivityPage page = new ActivityPage();
int offset = 0;
do {
filterStatement.query = "ORDER BY id LIMIT 500 OFFSET " + offset;
// Get activities by statement.
page = activityService.getActivitiesByStatement(filterStatement);
// Display results.
if (page.results != null) {
foreach (Activity activity in page.results) {
Console.WriteLine("{0}) Activity with ID \"{1}\", name \"{2}\" and type \"{3}\" " +
"was found.\n", totalResultsCounter, activity.id, activity.name,
activity.type);
totalResultsCounter++;
}
}
offset += 500;
} while (offset < page.totalResultSetSize);
Console.WriteLine("Number of results found: {0}.", totalResultsCounter);
} catch (Exception ex) {
Console.WriteLine("Failed to get contacts. Exception says \"{0}\"", ex.Message);
}
}
开发者ID:hassanasd,项目名称:googleads-dfp-dotnet-lib,代码行数:39,代码来源:GetAllActivities.cs
示例15: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(DfpUser user)
{
// Get the OrderService.
LineItemService lineItemService = (LineItemService) user.GetService(
DfpService.v201403.LineItemService);
long orderId = long.Parse(_T("INSERT_ORDER_ID_HERE"));
try {
// Create statement to only select line items for the given order that
// have been modified in the last 3 days.
DateTime threeDaysAgo = DateTimeUtilities.FromDateTime(System.DateTime.Now.AddDays(-3));
Statement filterStatement = new StatementBuilder(
"WHERE lastModifiedDateTime >= :lastModifiedDateTime AND orderId = :orderId LIMIT 500").
AddValue("lastModifiedDateTime", threeDaysAgo).
AddValue("orderId", orderId).ToStatement();
// Get line items by statement.
LineItemPage page = lineItemService.getLineItemsByStatement(filterStatement);
// Display results.
if (page != null && page.results != null) {
foreach (LineItem lineItem in page.results) {
Console.WriteLine("Line item with id \"{0}\", belonging to order id \"{1}\" and " +
"named \"{2}\" was found.", lineItem.id, lineItem.orderId, lineItem.name);
}
Console.WriteLine("Number of results found: {1}.", page.totalResultSetSize);
} else {
Console.WriteLine("No line items were found.");
}
} catch (Exception ex) {
Console.WriteLine("Failed to get line items. Exception says \"{0}\"", ex.Message);
}
}
开发者ID:hassanasd,项目名称:googleads-dfp-dotnet-lib,代码行数:38,代码来源:GetRecentlyUpdatedLineItems.cs
示例16: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(DfpUser user) {
// Get the CompanyService.
CompanyService companyService =
(CompanyService) user.GetService(DfpService.v201403.CompanyService);
// Create a Statement to only select companies that are advertisers sorted
// by name.
StatementBuilder statementBuilder = new StatementBuilder()
.Where("type = :advertiser")
.OrderBy("name ASC")
.Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.AddValue("advertiser", CompanyType.ADVERTISER.ToString());
CompanyPage page = new CompanyPage();
try {
do {
// Get companies by Statement.
page = companyService.getCompaniesByStatement(statementBuilder.ToStatement());
if (page.results != null && page.results.Length > 0) {
int i = page.startIndex;
foreach (Company company in page.results) {
Console.WriteLine("{0}) Company with ID = {1}, name = {2} and type = {3} was found",
i, company.id, company.name, company.type);
i++;
}
}
statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.GetOffset() < page.totalResultSetSize);
Console.WriteLine("Number of results found: {0}", page.totalResultSetSize);
} catch (Exception ex) {
Console.WriteLine("Failed to get companies. Exception says \"{0}\"", ex.Message);
}
}
开发者ID:GerryT01,项目名称:googleads-dotnet-lib,代码行数:39,代码来源:GetCompaniesByStatement.cs
示例17: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(DfpUser user)
{
ReportService reportService = (ReportService) user.GetService(
DfpService.v201403.ReportService);
// Get the NetworkService.
NetworkService networkService = (NetworkService) user.GetService(
DfpService.v201403.NetworkService);
// Get the root ad unit ID to filter on.
String rootAdUnitId = networkService.getCurrentNetwork().effectiveRootAdUnitId;
// Create statement to filter on an ancestor ad unit with the root ad unit ID to include all
// ad units in the network.
StatementBuilder statementBuilder = new StatementBuilder(
"where AD_UNIT_ANCESTOR_AD_UNIT_ID = :ancestorAdUnitId").
AddValue("ancestorAdUnitId", long.Parse(rootAdUnitId));
// Create report query.
ReportQuery reportQuery = new ReportQuery();
reportQuery.dimensions =
new Dimension[] { Dimension.AD_UNIT_ID, Dimension.AD_UNIT_NAME };
reportQuery.columns = new Column[] {Column.AD_SERVER_IMPRESSIONS,
Column.AD_SERVER_CLICKS, Column.DYNAMIC_ALLOCATION_INVENTORY_LEVEL_IMPRESSIONS,
Column.DYNAMIC_ALLOCATION_INVENTORY_LEVEL_CLICKS,
Column.TOTAL_INVENTORY_LEVEL_IMPRESSIONS,
Column.TOTAL_INVENTORY_LEVEL_CPM_AND_CPC_REVENUE};
// Set the filter statement.
reportQuery.statement = statementBuilder.ToStatement();
reportQuery.adUnitView = ReportQueryAdUnitView.HIERARCHICAL;
reportQuery.dateRangeType = DateRangeType.LAST_WEEK;
// Create report job.
ReportJob reportJob = new ReportJob();
reportJob.reportQuery = reportQuery;
try {
// Run report.
reportJob = reportService.runReportJob(reportJob);
// Wait for report to complete.
while (reportJob.reportJobStatus == ReportJobStatus.IN_PROGRESS) {
Console.WriteLine("Report job with id = '{0}' is still running.", reportJob.id);
Thread.Sleep(30000);
// Get report job.
reportJob = reportService.getReportJob(reportJob.id);
}
if (reportJob.reportJobStatus == ReportJobStatus.COMPLETED) {
Console.WriteLine("Report job with id = '{0}' completed successfully.", reportJob.id);
} else if (reportJob.reportJobStatus == ReportJobStatus.FAILED) {
Console.WriteLine("Report job with id = '{0}' failed to complete successfully.",
reportJob.id);
}
} catch (Exception ex) {
Console.WriteLine("Failed to run inventory report. Exception says \"{0}\"",
ex.Message);
}
}
开发者ID:hassanasd,项目名称:googleads-dfp-dotnet-lib,代码行数:64,代码来源:RunInventoryReport.cs
示例18: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(DfpUser user)
{
// Get the LabelService.
LabelService labelService =
(LabelService) user.GetService(DfpService.v201403.LabelService);
// Create a statement to only select labels that are competitive
// sorted by name.
Statement filterStatement = new StatementBuilder("WHERE type = :type ORDER BY name LIMIT 500")
.AddValue("type", LabelType.COMPETITIVE_EXCLUSION.ToString()).ToStatement();
try {
// Get labels by statement.
LabelPage page = labelService.getLabelsByStatement(filterStatement);
if (page.results != null) {
int i = page.startIndex;
foreach (Label label in page.results) {
StringBuilder builder = new StringBuilder();
foreach (LabelType labelType in label.types) {
builder.AppendFormat("{0} | ", labelType);
}
Console.WriteLine("{0}) Label with ID '{1}', name '{2}'and type '{3}' was found.",
i, label.id, label.name, builder.ToString().TrimEnd(' ', '|'));
i++;
}
}
Console.WriteLine("Number of results found: " + page.totalResultSetSize);
} catch (Exception ex) {
Console.WriteLine("Failed to get labels. Exception says \"{0}\"", ex.Message);
}
}
开发者ID:hassanasd,项目名称:googleads-dfp-dotnet-lib,代码行数:37,代码来源:GetLabelsByStatement.cs
示例19: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(DfpUser user) {
// Get the CompanyService.
CompanyService companyService =
(CompanyService) user.GetService(DfpService.v201403.CompanyService);
// Set defaults for page and Statement.
CompanyPage page = new CompanyPage();
StatementBuilder statementBuilder = new StatementBuilder()
.OrderBy("id ASC")
.Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
try {
do {
// Get companies by Statement.
page = companyService.getCompaniesByStatement(statementBuilder.ToStatement());
if (page.results != null && page.results.Length > 0) {
int i = page.startIndex;
foreach (Company company in page.results) {
Console.WriteLine("{0}) Company with ID = {1}, name = {2} and type = {3} was found",
i, company.id, company.name, company.type);
i++;
}
}
statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.GetOffset() < page.totalResultSetSize);
Console.WriteLine("Number of results found: {0}", page.totalResultSetSize);
} catch (Exception ex) {
Console.WriteLine("Failed to get companies. Exception says \"{0}\"", ex.Message);
}
}
开发者ID:GerryT01,项目名称:googleads-dotnet-lib,代码行数:36,代码来源:GetAllCompanies.cs
示例20: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(DfpUser user) {
// Get the TeamService.
TeamService teamService = (TeamService) user.GetService(DfpService.v201403.TeamService);
// Create a statement to order teams by name.
StatementBuilder statementBuilder = new StatementBuilder()
.OrderBy("name ASC")
.Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
// Set default for page.
TeamPage page = new TeamPage();
try {
do {
// Get teams by statement.
page = teamService.getTeamsByStatement(statementBuilder.ToStatement());
// Display results.
if (page.results != null) {
int i = page.startIndex;
foreach (Team team in page.results) {
Console.WriteLine("{0}) Team with ID \"{1}\" and name \"{2}\" was found.",
i, team.id, team.name);
i++;
}
}
statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while(statementBuilder.GetOffset() < page.totalResultSetSize);
Console.WriteLine("Number of results found: " + page.totalResultSetSize);
} catch (Exception ex) {
Console.WriteLine("Failed to get teams by statement. Exception says \"{0}\"", ex.Message);
}
}
开发者ID:klimenkor,项目名称:googleads-dotnet-lib,代码行数:38,代码来源:GetTeamsByStatement.cs
注:本文中的Google.Api.Ads.Dfp.Util.v201403.StatementBuilder类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论