Package com.google.api.ads.dfp.v201306

Examples of com.google.api.ads.dfp.v201306.CompanyServiceInterface


    // Get DfpUser from "~/dfp.properties".
    DfpUser user = new DfpUser();

    // Get the CompanyService.
    CompanyServiceInterface companyService =
        user.getService(DfpService.V201306.COMPANY_SERVICE);

    // Get companies by filter.
    CompanyPage page = companyService.getCompaniesByStatement(new Statement("LIMIT 1", null));
  }
View Full Code Here


  public static void main(String[] args) throws Exception {
    // Get DfpUser from "~/dfp.properties".
    DfpUser user = new DfpUser();

    // Get the CompanyService.
    CompanyServiceInterface companyService =
        user.getService(DfpService.V201306.COMPANY_SERVICE);

    // Initialize the root logger so that all messages do not filter up.
    DfpServiceLogger.initRootLogger();

    // Log the incoming and outgoing XML to System.out;
    DfpServiceLogger.logToStream(DfpServiceLogger.SOAP_XML_LOG, System.out);

    // Fake an exception to test logger which will not work yet.
    DfpServiceLogger.DFP_API_LIB_LOG.error("Error in the library.",
        new NullPointerException());

    // Log errors of the DFP library to System.err.
    DfpServiceLogger.logToStream(DfpServiceLogger.DFP_API_LIB_LOG, System.err, Level.ERROR);

    // Fake an exception to test logger which will work now.
    DfpServiceLogger.DFP_API_LIB_LOG.error("Error in the library.", new NullPointerException());

    // Get companies by filter.
    CompanyPage page = companyService.getCompaniesByStatement(new Statement("LIMIT 1", null));

    if (page.getResults() != null) {
      int i = page.getStartIndex();
      for (Company company : page.getResults()) {
        System.out.println(i + ") Company with ID \"" + company.getId()
View Full Code Here

    // Create the service accountant manager to automatically create
    // service accountants on first call and to not retain services.
    ServiceAccountantManager serviceAccountantManager = ServiceAccountantManager.getInstance();

    // Get the CompanyService.
    CompanyServiceInterface companyService = user.getService(DfpService.V201306.COMPANY_SERVICE);

    // Get the UserService.
    UserServiceInterface userService = user.getService(DfpService.V201306.USER_SERVICE);

    // Get the InventoryService.
View Full Code Here

   *     request
   */
  private static void makeApiRequest(DfpUser user) throws ServiceException, RemoteException,
      ApiException {
    // Service will use the auth token which was set by user.setAuthToken().
    CompanyServiceInterface companyService =
        user.getService(DfpService.V201306.COMPANY_SERVICE);
    companyService.getCompaniesByStatement(new Statement("LIMIT 1", null));
    System.out.println("Service call was successful.");
  }
View Full Code Here

      // Set the ID of the creative template to get.
      Long creativeTemplateId = Long.parseLong("INSERT_CREATIVE_TEMPLATE_ID_HERE");

      // Get the creative template.
      CreativeTemplate creativeTemplate =
          creativeTemplateService.getCreativeTemplate(creativeTemplateId);

      if (creativeTemplate != null) {
        System.out.println("Creative template with ID \"" + creativeTemplate.getId()
             + "\", name \"" + creativeTemplate.getName()
             + "\", and type \"" + creativeTemplate.getType() + "\" was found.");
        for (CreativeTemplateVariable variable : creativeTemplate.getVariables()) {
          System.out.println("Variable with name \"" + variable.getUniqueName() + "\" is "
              + (variable.getIsRequired() ? "required." : "optional."));
        }
      } else {
        System.out.println("No creative template found for this ID.");
View Full Code Here

      // Get the CreativeTemplateService.
      CreativeTemplateServiceInterface creativeTemplateService =
          user.getService(DfpService.V201306.CREATIVE_TEMPLATE_SERVICE);

      // Set defaults for page and filterStatement.
      CreativeTemplatePage page = new CreativeTemplatePage();
      Statement filterStatement = new Statement();
      int offset = 0;

      do {
        // Create a statement to get all creative templates.
        filterStatement.setQuery("LIMIT 500 OFFSET " + offset);

        // Get creative templates by statement.
        page = creativeTemplateService.getCreativeTemplatesByStatement(filterStatement);

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (CreativeTemplate creativeTemplate : page.getResults()) {
            System.out.println(i + ") Creative template with ID \"" + creativeTemplate.getId()
                + "\", name \"" + creativeTemplate.getName()
                + "\", and type \"" + creativeTemplate.getType() + "\" was found.");
            i++;
          }
        }

        offset += 500;
      } while (offset < page.getTotalResultSetSize());

      System.out.println("Number of results found: " + page.getTotalResultSetSize());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

      // Get DfpUser from "~/dfp.properties".
      DfpUser user = new DfpUser();

      // Get the CreativeTemplateService.
      CreativeTemplateServiceInterface creativeTemplateService =
          user.getService(DfpService.V201306.CREATIVE_TEMPLATE_SERVICE);

      // Set defaults for page and filterStatement.
      CreativeTemplatePage page = new CreativeTemplatePage();
      Statement filterStatement = new Statement();
      int offset = 0;

      do {
        // Create a statement to get all creative templates.
        filterStatement.setQuery("LIMIT 500 OFFSET " + offset);

        // Get creative templates by statement.
        page = creativeTemplateService.getCreativeTemplatesByStatement(filterStatement);

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (CreativeTemplate creativeTemplate : page.getResults()) {
            System.out.println(i + ") Creative template with ID \"" + creativeTemplate.getId()
View Full Code Here

   */
  public static Date fromDate(java.util.Date date) {
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(date);

    Date dfpDate = new Date();
    dfpDate.setYear(calendar.get(Calendar.YEAR));
    dfpDate.setMonth(calendar.get(Calendar.MONTH) + 1);
    dfpDate.setDay(calendar.get(Calendar.DAY_OF_MONTH));

    return dfpDate;
  }
View Full Code Here

   * @param date the DFP {@code Date} object to convert to a Java {@code Date}
   * @param timeZoneId the timezone of the date
   * @return the DFP {@code Date} object as a Java {@code Date} in the timezone
   */
  public static java.util.Date toDate(Date date, String timeZoneId) {
    return DateTimeUtils.toDate(new DateTime(date, 0, 0, 0, timeZoneId));
  }
View Full Code Here

   */
  public static DateTime fromDate(java.util.Date date) {
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(date);

    DateTime dfpDateTime = new DateTime();
    dfpDateTime.setDate(DateUtils.fromDate(date));
    dfpDateTime.setHour(calendar.get(Calendar.HOUR_OF_DAY));
    dfpDateTime.setMinute(calendar.get(Calendar.MINUTE));
    dfpDateTime.setSecond(calendar.get(Calendar.SECOND));

    return dfpDateTime;
  }
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.v201306.CompanyServiceInterface

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.