Search in sources :

Example 1 with CdnConfigurationPage

use of com.google.api.ads.admanager.axis.v202111.CdnConfigurationPage in project googleads-java-lib by googleads.

the class GetAllCdnConfigurations method runExample.

/**
 * Runs the example.
 *
 * @param adManagerServices the services factory.
 * @param session the session.
 * @throws ApiException if the API request failed with one or more service errors.
 * @throws RemoteException if the API request failed due to other errors.
 */
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException {
    CdnConfigurationServiceInterface cdnConfigurationService = adManagerServices.get(session, CdnConfigurationServiceInterface.class);
    // Create a statement to select CDN configurations.
    int pageSize = StatementBuilder.SUGGESTED_PAGE_LIMIT;
    StatementBuilder statementBuilder = new StatementBuilder().orderBy("id ASC").limit(pageSize);
    // Retrieve a small amount of CDN configurations at a time, paging through until all
    // CDN configurations have been retrieved.
    int totalResultSetSize = 0;
    do {
        CdnConfigurationPage page = cdnConfigurationService.getCdnConfigurationsByStatement(statementBuilder.toStatement());
        // Print out some information for each CDN configuration.
        if (page.getResults() != null) {
            totalResultSetSize = page.getTotalResultSetSize();
            int i = page.getStartIndex();
            for (CdnConfiguration cdnConfiguration : page.getResults()) {
                System.out.printf("%d) CDN configuration with ID %d and name '%s' was found.%n", i++, cdnConfiguration.getId(), cdnConfiguration.getName());
            }
        }
        statementBuilder.increaseOffsetBy(pageSize);
    } while (statementBuilder.getOffset() < totalResultSetSize);
    System.out.printf("Number of results found: %d%n", totalResultSetSize);
}
Also used : CdnConfigurationServiceInterface(com.google.api.ads.admanager.axis.v202111.CdnConfigurationServiceInterface) StatementBuilder(com.google.api.ads.admanager.axis.utils.v202111.StatementBuilder) CdnConfiguration(com.google.api.ads.admanager.axis.v202111.CdnConfiguration) CdnConfigurationPage(com.google.api.ads.admanager.axis.v202111.CdnConfigurationPage)

Example 2 with CdnConfigurationPage

use of com.google.api.ads.admanager.axis.v202111.CdnConfigurationPage in project googleads-java-lib by googleads.

the class GetAllCdnConfigurations method runExample.

/**
 * Runs the example.
 *
 * @param adManagerServices the services factory.
 * @param session the session.
 * @throws ApiException if the API request failed with one or more service errors.
 * @throws RemoteException if the API request failed due to other errors.
 */
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException {
    CdnConfigurationServiceInterface cdnConfigurationService = adManagerServices.get(session, CdnConfigurationServiceInterface.class);
    // Create a statement to select CDN configurations.
    int pageSize = StatementBuilder.SUGGESTED_PAGE_LIMIT;
    StatementBuilder statementBuilder = new StatementBuilder().orderBy("id ASC").limit(pageSize);
    // Retrieve a small amount of CDN configurations at a time, paging through until all
    // CDN configurations have been retrieved.
    int totalResultSetSize = 0;
    do {
        CdnConfigurationPage page = cdnConfigurationService.getCdnConfigurationsByStatement(statementBuilder.toStatement());
        // Print out some information for each CDN configuration.
        if (page.getResults() != null) {
            totalResultSetSize = page.getTotalResultSetSize();
            int i = page.getStartIndex();
            for (CdnConfiguration cdnConfiguration : page.getResults()) {
                System.out.printf("%d) CDN configuration with ID %d and name '%s' was found.%n", i++, cdnConfiguration.getId(), cdnConfiguration.getName());
            }
        }
        statementBuilder.increaseOffsetBy(pageSize);
    } while (statementBuilder.getOffset() < totalResultSetSize);
    System.out.printf("Number of results found: %d%n", totalResultSetSize);
}
Also used : CdnConfigurationServiceInterface(com.google.api.ads.admanager.axis.v202108.CdnConfigurationServiceInterface) StatementBuilder(com.google.api.ads.admanager.axis.utils.v202108.StatementBuilder) CdnConfiguration(com.google.api.ads.admanager.axis.v202108.CdnConfiguration) CdnConfigurationPage(com.google.api.ads.admanager.axis.v202108.CdnConfigurationPage)

Example 3 with CdnConfigurationPage

use of com.google.api.ads.admanager.axis.v202111.CdnConfigurationPage in project googleads-java-lib by googleads.

the class GetAllCdnConfigurations method runExample.

/**
 * Runs the example.
 *
 * @param adManagerServices the services factory.
 * @param session the session.
 * @throws ApiException if the API request failed with one or more service errors.
 * @throws RemoteException if the API request failed due to other errors.
 */
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException {
    CdnConfigurationServiceInterface cdnConfigurationService = adManagerServices.get(session, CdnConfigurationServiceInterface.class);
    // Create a statement to select CDN configurations.
    int pageSize = StatementBuilder.SUGGESTED_PAGE_LIMIT;
    StatementBuilder statementBuilder = new StatementBuilder().orderBy("id ASC").limit(pageSize);
    // Retrieve a small amount of CDN configurations at a time, paging through until all
    // CDN configurations have been retrieved.
    int totalResultSetSize = 0;
    do {
        CdnConfigurationPage page = cdnConfigurationService.getCdnConfigurationsByStatement(statementBuilder.toStatement());
        // Print out some information for each CDN configuration.
        if (page.getResults() != null) {
            totalResultSetSize = page.getTotalResultSetSize();
            int i = page.getStartIndex();
            for (CdnConfiguration cdnConfiguration : page.getResults()) {
                System.out.printf("%d) CDN configuration with ID %d and name '%s' was found.%n", i++, cdnConfiguration.getId(), cdnConfiguration.getName());
            }
        }
        statementBuilder.increaseOffsetBy(pageSize);
    } while (statementBuilder.getOffset() < totalResultSetSize);
    System.out.printf("Number of results found: %d%n", totalResultSetSize);
}
Also used : CdnConfigurationServiceInterface(com.google.api.ads.admanager.axis.v202202.CdnConfigurationServiceInterface) StatementBuilder(com.google.api.ads.admanager.axis.utils.v202202.StatementBuilder) CdnConfiguration(com.google.api.ads.admanager.axis.v202202.CdnConfiguration) CdnConfigurationPage(com.google.api.ads.admanager.axis.v202202.CdnConfigurationPage)

Aggregations

StatementBuilder (com.google.api.ads.admanager.axis.utils.v202108.StatementBuilder)1 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202111.StatementBuilder)1 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202202.StatementBuilder)1 CdnConfiguration (com.google.api.ads.admanager.axis.v202108.CdnConfiguration)1 CdnConfigurationPage (com.google.api.ads.admanager.axis.v202108.CdnConfigurationPage)1 CdnConfigurationServiceInterface (com.google.api.ads.admanager.axis.v202108.CdnConfigurationServiceInterface)1 CdnConfiguration (com.google.api.ads.admanager.axis.v202111.CdnConfiguration)1 CdnConfigurationPage (com.google.api.ads.admanager.axis.v202111.CdnConfigurationPage)1 CdnConfigurationServiceInterface (com.google.api.ads.admanager.axis.v202111.CdnConfigurationServiceInterface)1 CdnConfiguration (com.google.api.ads.admanager.axis.v202202.CdnConfiguration)1 CdnConfigurationPage (com.google.api.ads.admanager.axis.v202202.CdnConfigurationPage)1 CdnConfigurationServiceInterface (com.google.api.ads.admanager.axis.v202202.CdnConfigurationServiceInterface)1