Search in sources :

Example 1 with TrafficForecastSegmentPage

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

the class GetAllTrafficForecastSegments 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 {
    // Get the AdjustmentService.
    AdjustmentServiceInterface adjustmentService = adManagerServices.get(session, AdjustmentServiceInterface.class);
    // Create a statement to get all traffic forecast segments.
    StatementBuilder statementBuilder = new StatementBuilder().orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
    // Default for total result set size.
    int totalResultSetSize = 0;
    do {
        // Get traffic forecast segments by statement.
        TrafficForecastSegmentPage page = adjustmentService.getTrafficForecastSegmentsByStatement(statementBuilder.toStatement());
        if (page.getResults() != null) {
            totalResultSetSize = page.getTotalResultSetSize();
            int i = page.getStartIndex();
            for (TrafficForecastSegment trafficForecastSegment : page.getResults()) {
                System.out.printf("%d) Traffic forecast segment with ID %d and name '%s' was found.%n", i++, trafficForecastSegment.getId(), trafficForecastSegment.getName());
            }
        }
        statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
    } while (statementBuilder.getOffset() < totalResultSetSize);
    System.out.printf("Number of results found: %d%n", totalResultSetSize);
}
Also used : TrafficForecastSegment(com.google.api.ads.admanager.axis.v202108.TrafficForecastSegment) TrafficForecastSegmentPage(com.google.api.ads.admanager.axis.v202108.TrafficForecastSegmentPage) StatementBuilder(com.google.api.ads.admanager.axis.utils.v202108.StatementBuilder) AdjustmentServiceInterface(com.google.api.ads.admanager.axis.v202108.AdjustmentServiceInterface)

Example 2 with TrafficForecastSegmentPage

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

the class GetAllTrafficForecastSegments 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 {
    // Get the AdjustmentService.
    AdjustmentServiceInterface adjustmentService = adManagerServices.get(session, AdjustmentServiceInterface.class);
    // Create a statement to get all traffic forecast segments.
    StatementBuilder statementBuilder = new StatementBuilder().orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
    // Default for total result set size.
    int totalResultSetSize = 0;
    do {
        // Get traffic forecast segments by statement.
        TrafficForecastSegmentPage page = adjustmentService.getTrafficForecastSegmentsByStatement(statementBuilder.toStatement());
        if (page.getResults() != null) {
            totalResultSetSize = page.getTotalResultSetSize();
            int i = page.getStartIndex();
            for (TrafficForecastSegment trafficForecastSegment : page.getResults()) {
                System.out.printf("%d) Traffic forecast segment with ID %d and name '%s' was found.%n", i++, trafficForecastSegment.getId(), trafficForecastSegment.getName());
            }
        }
        statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
    } while (statementBuilder.getOffset() < totalResultSetSize);
    System.out.printf("Number of results found: %d%n", totalResultSetSize);
}
Also used : TrafficForecastSegment(com.google.api.ads.admanager.axis.v202111.TrafficForecastSegment) TrafficForecastSegmentPage(com.google.api.ads.admanager.axis.v202111.TrafficForecastSegmentPage) StatementBuilder(com.google.api.ads.admanager.axis.utils.v202111.StatementBuilder) AdjustmentServiceInterface(com.google.api.ads.admanager.axis.v202111.AdjustmentServiceInterface)

Example 3 with TrafficForecastSegmentPage

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

the class GetAllTrafficForecastSegments 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 {
    // Get the AdjustmentService.
    AdjustmentServiceInterface adjustmentService = adManagerServices.get(session, AdjustmentServiceInterface.class);
    // Create a statement to get all traffic forecast segments.
    StatementBuilder statementBuilder = new StatementBuilder().orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
    // Default for total result set size.
    int totalResultSetSize = 0;
    do {
        // Get traffic forecast segments by statement.
        TrafficForecastSegmentPage page = adjustmentService.getTrafficForecastSegmentsByStatement(statementBuilder.toStatement());
        if (page.getResults() != null) {
            totalResultSetSize = page.getTotalResultSetSize();
            int i = page.getStartIndex();
            for (TrafficForecastSegment trafficForecastSegment : page.getResults()) {
                System.out.printf("%d) Traffic forecast segment with ID %d and name '%s' was found.%n", i++, trafficForecastSegment.getId(), trafficForecastSegment.getName());
            }
        }
        statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
    } while (statementBuilder.getOffset() < totalResultSetSize);
    System.out.printf("Number of results found: %d%n", totalResultSetSize);
}
Also used : TrafficForecastSegment(com.google.api.ads.admanager.axis.v202202.TrafficForecastSegment) TrafficForecastSegmentPage(com.google.api.ads.admanager.axis.v202202.TrafficForecastSegmentPage) StatementBuilder(com.google.api.ads.admanager.axis.utils.v202202.StatementBuilder) AdjustmentServiceInterface(com.google.api.ads.admanager.axis.v202202.AdjustmentServiceInterface)

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 AdjustmentServiceInterface (com.google.api.ads.admanager.axis.v202108.AdjustmentServiceInterface)1 TrafficForecastSegment (com.google.api.ads.admanager.axis.v202108.TrafficForecastSegment)1 TrafficForecastSegmentPage (com.google.api.ads.admanager.axis.v202108.TrafficForecastSegmentPage)1 AdjustmentServiceInterface (com.google.api.ads.admanager.axis.v202111.AdjustmentServiceInterface)1 TrafficForecastSegment (com.google.api.ads.admanager.axis.v202111.TrafficForecastSegment)1 TrafficForecastSegmentPage (com.google.api.ads.admanager.axis.v202111.TrafficForecastSegmentPage)1 AdjustmentServiceInterface (com.google.api.ads.admanager.axis.v202202.AdjustmentServiceInterface)1 TrafficForecastSegment (com.google.api.ads.admanager.axis.v202202.TrafficForecastSegment)1 TrafficForecastSegmentPage (com.google.api.ads.admanager.axis.v202202.TrafficForecastSegmentPage)1