Package com.google.api.ads.dfp.axis.v201311

Examples of com.google.api.ads.dfp.axis.v201311.Date


    // Default for total result set size.
    int totalResultSetSize = 0;

    do {
      // Get companies by statement.
      CompanyPage page = companyService.getCompaniesByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (Company company : page.getResults()) {
          System.out.printf(
              "%d) Company with ID \"%d\", name \"%s\", and type \"%s\" was found.\n", i++,
              company.getId(), company.getName(), company.getType());
        }
      }
View Full Code Here


*/
public class CreateCompanies {

  public static void runExample(DfpServices dfpServices, DfpSession session) throws Exception {
    // Get the CompanyService.
    CompanyServiceInterface companyService =
        dfpServices.get(session, CompanyServiceInterface.class);

    // Create an advertiser.
    Company advertiser = new Company();
    advertiser.setName("Advertiser #" + new Random().nextInt(Integer.MAX_VALUE));
    advertiser.setType(CompanyType.ADVERTISER);

    // Create an agency.
    Company agency = new Company();
    agency.setName("Agency #" + new Random().nextInt(Integer.MAX_VALUE));
    agency.setType(CompanyType.AGENCY);

    // Create the companies on the server.
    Company[] companies = companyService.createCompanies(new Company[] {advertiser, agency});

    for (Company createdCompany : companies) {
      System.out.printf("A company with ID \"%d\", name \"%s\", and type \"%s\" was created.\n",
          createdCompany.getId(), createdCompany.getName(), createdCompany.getType());
    }
View Full Code Here

*/
public class GetAdvertisers {

  public static void runExample(DfpServices dfpServices, DfpSession session) throws Exception {
    // Get the CompanyService.
    CompanyServiceInterface companyService =
        dfpServices.get(session, CompanyServiceInterface.class);

    // Create a statement to only select companies that are advertisers.
    StatementBuilder statementBuilder = new StatementBuilder()
        .where("type = :type")
        .orderBy("id ASC")
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
        .withBindVariableValue("type", CompanyType.ADVERTISER.toString());

    // Default for total result set size.
    int totalResultSetSize = 0;

    do {
      // Get companies by statement.
      CompanyPage page = companyService.getCompaniesByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (Company company : page.getResults()) {
View Full Code Here

*/
public class GetAllCompanies {

  public static void runExample(DfpServices dfpServices, DfpSession session) throws Exception {
    // Get the CompanyService.
    CompanyServiceInterface companyService =
        dfpServices.get(session, CompanyServiceInterface.class);

    // Create a statement to get all companies.
    StatementBuilder statementBuilder = new StatementBuilder()
        .orderBy("id ASC")
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

    // Default for total result set size.
    int totalResultSetSize = 0;

    do {
      // Get companies by statement.
      CompanyPage page = companyService.getCompaniesByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (Company company : page.getResults()) {
View Full Code Here

  private static final String COMPANY_ID = "INSERT_COMPANY_ID_HERE";

  public static void runExample(DfpServices dfpServices, DfpSession session, long companyId)
      throws Exception {
    // Get the CompanyService.
    CompanyServiceInterface companyService =
        dfpServices.get(session, CompanyServiceInterface.class);

    // Get the company.
    Company company = companyService.getCompany(companyId);

    // Update the comment.
    company.setComment(company.getComment() + " Updated.");

    // Update the company on the server.
    Company[] companies = companyService.updateCompanies(new Company[] {company});

    for (Company updatedCompany : companies) {
      System.out.printf(
          "Company with ID \"%d\", name \"%s\", and comment \"%s\" was updated.\n",
          updatedCompany.getId(), updatedCompany.getName(), updatedCompany.getComment());
View Full Code Here

    // Get the CreativeService.
    CreativeServiceInterface creativeService =
        dfpServices.get(session, CreativeServiceInterface.class);

    // Get the creative.
    Creative creative = creativeService.getCreative(creativeId);

    // Only update the destination URL if it has one.
    if (creative instanceof HasDestinationUrlCreative) {
      HasDestinationUrlCreative hasDestinationUrlCreative = (HasDestinationUrlCreative) creative;
View Full Code Here

    imageCreative.setAdvertiserId(advertiserId);
    imageCreative.setDestinationUrl("http://google.com");
    imageCreative.setSize(size);

    // Create image asset.
    CreativeAsset creativeAsset = new CreativeAsset();
    creativeAsset.setFileName("image.jpg");
    creativeAsset.setAssetByteArray(Media.getMediaDataFromUrl(
        "http://www.google.com/intl/en/adwords/select/images/samples/inline.jpg"));
    creativeAsset.setSize(size);
    imageCreative.setPrimaryImageAsset(creativeAsset);

    // Create an image redirect creative.
    ImageRedirectCreative imageRedirectCreative = new ImageRedirectCreative();
    imageRedirectCreative.setName(
View Full Code Here

    // Modify existing image creative to copy it.
    imageCreative.setId(null);
    imageCreative.setName("Image creative copy #" + new Random().nextInt(Integer.MAX_VALUE));

    // Create copy of image asset.
    CreativeAsset creativeAsset = new CreativeAsset();
    creativeAsset.setFileName("image.jpg");
    creativeAsset.setAssetByteArray(Media.getMediaDataFromUrl(
        imageCreative.getPrimaryImageAsset().getAssetUrl()));
    creativeAsset.setSize(imageCreative.getPrimaryImageAsset().getSize());
    imageCreative.setPrimaryImageAsset(creativeAsset);

    // Create the creative on the server.
    Creative[] creatives =
        creativeService.createCreatives(new Creative[] {imageCreative});
View Full Code Here

    // Default for total result set size.
    int totalResultSetSize = 0;

    do {
      // Get creatives by statement.
      CreativePage page = creativeService.getCreativesByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (Creative creative : page.getResults()) {
          System.out.printf(
              "%d) Creative with ID \"%d\" and name \"%s\" was found.\n", i++,
              creative.getId(), creative.getName());
        }
      }
View Full Code Here

    // Default for total result set size.
    int totalResultSetSize = 0;

    do {
      // Get creatives by statement.
      CreativePage page = creativeService.getCreativesByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (Creative creative : page.getResults()) {
          System.out.printf(
              "%d) Creative with ID \"%d\" and name \"%s\" was found.\n", i++,
              creative.getId(), creative.getName());
        }
      }
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.axis.v201311.Date

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.