Search in sources :

Example 16 with LineItemCreativeAssociationServiceInterface

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

the class PushCreativeToDevices method runExample.

/**
 * Runs the example.
 *
 * @param adManagerServices the services factory.
 * @param session the session.
 * @param lineItemId the ID of the line item to push to a device.
 * @param creativeId the ID of the creative
 *       to push to a device.
 * @param linkedDeviceId the ID of the linked device to push the LICA to.
 * @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, long lineItemId, long creativeId, long linkedDeviceId) throws RemoteException {
    // Get the LineItemCreativeAssociationService.
    LineItemCreativeAssociationServiceInterface licaService = adManagerServices.get(session, LineItemCreativeAssociationServiceInterface.class);
    // Create a statement to select a single linked device.
    // Linked devices can be read from the linked_device PQL table.
    StatementBuilder statementBuilder = new StatementBuilder().where("WHERE id = :linkedDeviceId").withBindVariableValue("linkedDeviceId", linkedDeviceId);
    CreativePushOptions options = new CreativePushOptions();
    options.setLineItemId(lineItemId);
    options.setCreativeId(creativeId);
    UpdateResult updateResult = licaService.pushCreativeToDevices(statementBuilder.toStatement(), options);
    System.out.printf("Pushed creative to %d devices%n", updateResult.getNumChanges());
}
Also used : CreativePushOptions(com.google.api.ads.admanager.axis.v202111.CreativePushOptions) StatementBuilder(com.google.api.ads.admanager.axis.utils.v202111.StatementBuilder) LineItemCreativeAssociationServiceInterface(com.google.api.ads.admanager.axis.v202111.LineItemCreativeAssociationServiceInterface) UpdateResult(com.google.api.ads.admanager.axis.v202111.UpdateResult)

Example 17 with LineItemCreativeAssociationServiceInterface

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

the class PushCreativeToDevices method runExample.

/**
 * Runs the example.
 *
 * @param adManagerServices the services factory.
 * @param session the session.
 * @param lineItemId the ID of the line item to push to a device.
 * @param creativeId the ID of the creative
 *       to push to a device.
 * @param linkedDeviceId the ID of the linked device to push the LICA to.
 * @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, long lineItemId, long creativeId, long linkedDeviceId) throws RemoteException {
    // Get the LineItemCreativeAssociationService.
    LineItemCreativeAssociationServiceInterface licaService = adManagerServices.get(session, LineItemCreativeAssociationServiceInterface.class);
    // Create a statement to select a single linked device.
    // Linked devices can be read from the linked_device PQL table.
    StatementBuilder statementBuilder = new StatementBuilder().where("WHERE id = :linkedDeviceId").withBindVariableValue("linkedDeviceId", linkedDeviceId);
    CreativePushOptions options = new CreativePushOptions();
    options.setLineItemId(lineItemId);
    options.setCreativeId(creativeId);
    UpdateResult updateResult = licaService.pushCreativeToDevices(statementBuilder.toStatement(), options);
    System.out.printf("Pushed creative to %d devices%n", updateResult.getNumChanges());
}
Also used : CreativePushOptions(com.google.api.ads.admanager.axis.v202202.CreativePushOptions) StatementBuilder(com.google.api.ads.admanager.axis.utils.v202202.StatementBuilder) LineItemCreativeAssociationServiceInterface(com.google.api.ads.admanager.axis.v202202.LineItemCreativeAssociationServiceInterface) UpdateResult(com.google.api.ads.admanager.axis.v202202.UpdateResult)

Example 18 with LineItemCreativeAssociationServiceInterface

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

the class UpdateLicas method runExample.

/**
 * Runs the example.
 *
 * @param adManagerServices the services factory.
 * @param session the session.
 * @param lineItemId the line item ID of the LICA.
 * @param creativeId the master or creative set ID of the LICA. For creative sets, set the master
 *     creative ID.
 * @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, long lineItemId, long creativeId) throws RemoteException {
    // Get the LineItemCreativeAssociationService.
    LineItemCreativeAssociationServiceInterface licaService = adManagerServices.get(session, LineItemCreativeAssociationServiceInterface.class);
    // Create a statement to select a single LICA for a line item.
    StatementBuilder statementBuilder = new StatementBuilder().where("lineItemId = :lineItemId AND creativeId = :creativeId").orderBy("lineItemId ASC, creativeId ASC").limit(1).withBindVariableValue("lineItemId", lineItemId).withBindVariableValue("creativeId", creativeId);
    // Get the LICA.
    LineItemCreativeAssociationPage page = licaService.getLineItemCreativeAssociationsByStatement(statementBuilder.toStatement());
    LineItemCreativeAssociation lica = Iterables.getOnlyElement(Arrays.asList(page.getResults()));
    // Update the destination URL.
    lica.setDestinationUrl("http://news.google.com?newTrackingParameter");
    // Update the LICA on the server.
    LineItemCreativeAssociation[] licas = licaService.updateLineItemCreativeAssociations(new LineItemCreativeAssociation[] { lica });
    for (LineItemCreativeAssociation updatedLica : licas) {
        System.out.printf("LICA with line item ID %d and creative ID %d was updated.%n", updatedLica.getLineItemId(), updatedLica.getCreativeId());
    }
}
Also used : LineItemCreativeAssociation(com.google.api.ads.admanager.axis.v202202.LineItemCreativeAssociation) StatementBuilder(com.google.api.ads.admanager.axis.utils.v202202.StatementBuilder) LineItemCreativeAssociationPage(com.google.api.ads.admanager.axis.v202202.LineItemCreativeAssociationPage) LineItemCreativeAssociationServiceInterface(com.google.api.ads.admanager.axis.v202202.LineItemCreativeAssociationServiceInterface)

Aggregations

LineItemCreativeAssociationServiceInterface (com.google.api.ads.admanager.axis.v202108.LineItemCreativeAssociationServiceInterface)6 LineItemCreativeAssociationServiceInterface (com.google.api.ads.admanager.axis.v202111.LineItemCreativeAssociationServiceInterface)6 LineItemCreativeAssociationServiceInterface (com.google.api.ads.admanager.axis.v202202.LineItemCreativeAssociationServiceInterface)6 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202108.StatementBuilder)5 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202111.StatementBuilder)5 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202202.StatementBuilder)5 LineItemCreativeAssociation (com.google.api.ads.admanager.axis.v202108.LineItemCreativeAssociation)5 LineItemCreativeAssociation (com.google.api.ads.admanager.axis.v202111.LineItemCreativeAssociation)5 LineItemCreativeAssociation (com.google.api.ads.admanager.axis.v202202.LineItemCreativeAssociation)5 LineItemCreativeAssociationPage (com.google.api.ads.admanager.axis.v202108.LineItemCreativeAssociationPage)4 LineItemCreativeAssociationPage (com.google.api.ads.admanager.axis.v202111.LineItemCreativeAssociationPage)4 LineItemCreativeAssociationPage (com.google.api.ads.admanager.axis.v202202.LineItemCreativeAssociationPage)4 UpdateResult (com.google.api.ads.admanager.axis.v202108.UpdateResult)2 UpdateResult (com.google.api.ads.admanager.axis.v202111.UpdateResult)2 UpdateResult (com.google.api.ads.admanager.axis.v202202.UpdateResult)2 CreativePushOptions (com.google.api.ads.admanager.axis.v202108.CreativePushOptions)1 DeactivateLineItemCreativeAssociations (com.google.api.ads.admanager.axis.v202108.DeactivateLineItemCreativeAssociations)1 CreativePushOptions (com.google.api.ads.admanager.axis.v202111.CreativePushOptions)1 DeactivateLineItemCreativeAssociations (com.google.api.ads.admanager.axis.v202111.DeactivateLineItemCreativeAssociations)1 CreativePushOptions (com.google.api.ads.admanager.axis.v202202.CreativePushOptions)1