use of com.google.api.ads.admanager.axis.v202202.DeliveryForecastOptions 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);
}
}
use of com.google.api.ads.admanager.axis.v202202.DeliveryForecastOptions 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);
}
}
use of com.google.api.ads.admanager.axis.v202202.DeliveryForecastOptions 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);
}
}
Aggregations