Search in sources :

Example 1 with DeliveryForecast

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

the class GetDeliveryForecastForLineItems method runExample.

/**
 * Runs the example.
 *
 * @param adManagerServices the services factory.
 * @param session the session.
 * @param lineItemIds the IDs of the line items to get a forecast for. You may pass multiple
 *     values.
 * @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, List<Long> lineItemIds) throws RemoteException {
    // Get the ForecastService.
    ForecastServiceInterface forecastService = adManagerServices.get(session, ForecastServiceInterface.class);
    DeliveryForecastOptions options = new DeliveryForecastOptions();
    DeliveryForecast forecast = forecastService.getDeliveryForecastByIds(Longs.toArray(lineItemIds), options);
    for (LineItemDeliveryForecast lineItemForecast : forecast.getLineItemDeliveryForecasts()) {
        String unitType = lineItemForecast.getUnitType().toString().toLowerCase();
        System.out.printf("Forecast for line item %d:%n", lineItemForecast.getLineItemId());
        System.out.printf("\t%d %s matched%n", lineItemForecast.getMatchedUnits(), unitType);
        System.out.printf("\t%d %s delivered%n", lineItemForecast.getDeliveredUnits(), unitType);
        System.out.printf("\t%d %s predicted%n", lineItemForecast.getPredictedDeliveryUnits(), unitType);
    }
}
Also used : ForecastServiceInterface(com.google.api.ads.admanager.axis.v202202.ForecastServiceInterface) DeliveryForecastOptions(com.google.api.ads.admanager.axis.v202202.DeliveryForecastOptions) LineItemDeliveryForecast(com.google.api.ads.admanager.axis.v202202.LineItemDeliveryForecast) DeliveryForecast(com.google.api.ads.admanager.axis.v202202.DeliveryForecast) LineItemDeliveryForecast(com.google.api.ads.admanager.axis.v202202.LineItemDeliveryForecast)

Example 2 with DeliveryForecast

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

the class GetDeliveryForecastForLineItems method runExample.

/**
 * Runs the example.
 *
 * @param adManagerServices the services factory.
 * @param session the session.
 * @param lineItemIds the IDs of the line items to get a forecast for. You may pass multiple
 *     values.
 * @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, List<Long> lineItemIds) throws RemoteException {
    // Get the ForecastService.
    ForecastServiceInterface forecastService = adManagerServices.get(session, ForecastServiceInterface.class);
    DeliveryForecastOptions options = new DeliveryForecastOptions();
    DeliveryForecast forecast = forecastService.getDeliveryForecastByIds(Longs.toArray(lineItemIds), options);
    for (LineItemDeliveryForecast lineItemForecast : forecast.getLineItemDeliveryForecasts()) {
        String unitType = lineItemForecast.getUnitType().toString().toLowerCase();
        System.out.printf("Forecast for line item %d:%n", lineItemForecast.getLineItemId());
        System.out.printf("\t%d %s matched%n", lineItemForecast.getMatchedUnits(), unitType);
        System.out.printf("\t%d %s delivered%n", lineItemForecast.getDeliveredUnits(), unitType);
        System.out.printf("\t%d %s predicted%n", lineItemForecast.getPredictedDeliveryUnits(), unitType);
    }
}
Also used : ForecastServiceInterface(com.google.api.ads.admanager.axis.v202111.ForecastServiceInterface) DeliveryForecastOptions(com.google.api.ads.admanager.axis.v202111.DeliveryForecastOptions) DeliveryForecast(com.google.api.ads.admanager.axis.v202111.DeliveryForecast) LineItemDeliveryForecast(com.google.api.ads.admanager.axis.v202111.LineItemDeliveryForecast) LineItemDeliveryForecast(com.google.api.ads.admanager.axis.v202111.LineItemDeliveryForecast)

Example 3 with DeliveryForecast

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

the class GetDeliveryForecastForLineItems method runExample.

/**
 * Runs the example.
 *
 * @param adManagerServices the services factory.
 * @param session the session.
 * @param lineItemIds the IDs of the line items to get a forecast for. You may pass multiple
 *     values.
 * @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, List<Long> lineItemIds) throws RemoteException {
    // Get the ForecastService.
    ForecastServiceInterface forecastService = adManagerServices.get(session, ForecastServiceInterface.class);
    DeliveryForecastOptions options = new DeliveryForecastOptions();
    DeliveryForecast forecast = forecastService.getDeliveryForecastByIds(Longs.toArray(lineItemIds), options);
    for (LineItemDeliveryForecast lineItemForecast : forecast.getLineItemDeliveryForecasts()) {
        String unitType = lineItemForecast.getUnitType().toString().toLowerCase();
        System.out.printf("Forecast for line item %d:%n", lineItemForecast.getLineItemId());
        System.out.printf("\t%d %s matched%n", lineItemForecast.getMatchedUnits(), unitType);
        System.out.printf("\t%d %s delivered%n", lineItemForecast.getDeliveredUnits(), unitType);
        System.out.printf("\t%d %s predicted%n", lineItemForecast.getPredictedDeliveryUnits(), unitType);
    }
}
Also used : ForecastServiceInterface(com.google.api.ads.admanager.axis.v202108.ForecastServiceInterface) DeliveryForecastOptions(com.google.api.ads.admanager.axis.v202108.DeliveryForecastOptions) DeliveryForecast(com.google.api.ads.admanager.axis.v202108.DeliveryForecast) LineItemDeliveryForecast(com.google.api.ads.admanager.axis.v202108.LineItemDeliveryForecast) LineItemDeliveryForecast(com.google.api.ads.admanager.axis.v202108.LineItemDeliveryForecast)

Aggregations

DeliveryForecast (com.google.api.ads.admanager.axis.v202108.DeliveryForecast)1 DeliveryForecastOptions (com.google.api.ads.admanager.axis.v202108.DeliveryForecastOptions)1 ForecastServiceInterface (com.google.api.ads.admanager.axis.v202108.ForecastServiceInterface)1 LineItemDeliveryForecast (com.google.api.ads.admanager.axis.v202108.LineItemDeliveryForecast)1 DeliveryForecast (com.google.api.ads.admanager.axis.v202111.DeliveryForecast)1 DeliveryForecastOptions (com.google.api.ads.admanager.axis.v202111.DeliveryForecastOptions)1 ForecastServiceInterface (com.google.api.ads.admanager.axis.v202111.ForecastServiceInterface)1 LineItemDeliveryForecast (com.google.api.ads.admanager.axis.v202111.LineItemDeliveryForecast)1 DeliveryForecast (com.google.api.ads.admanager.axis.v202202.DeliveryForecast)1 DeliveryForecastOptions (com.google.api.ads.admanager.axis.v202202.DeliveryForecastOptions)1 ForecastServiceInterface (com.google.api.ads.admanager.axis.v202202.ForecastServiceInterface)1 LineItemDeliveryForecast (com.google.api.ads.admanager.axis.v202202.LineItemDeliveryForecast)1