Search in sources :

Example 1 with ServiceLinkOperation

use of com.google.api.ads.adwords.axis.v201809.mcm.ServiceLinkOperation in project googleads-java-lib by googleads.

the class AcceptServiceLink method runExample.

/**
 * Runs the example.
 *
 * @param adWordsServices the services factory.
 * @param session the session.
 * @param serviceLinkId the ID of the service link to accept.
 * @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(AdWordsServicesInterface adWordsServices, AdWordsSession session, long serviceLinkId) throws RemoteException {
    // Get the CustomerService.
    CustomerServiceInterface customerService = adWordsServices.get(session, CustomerServiceInterface.class);
    // Create the operation to set the status to ACTIVE.
    ServiceLinkOperation op = new ServiceLinkOperation();
    op.setOperator(Operator.SET);
    ServiceLink serviceLink = new ServiceLink();
    serviceLink.setServiceLinkId(serviceLinkId);
    serviceLink.setServiceType(ServiceType.MERCHANT_CENTER);
    serviceLink.setLinkStatus(ServiceLinkLinkStatus.ACTIVE);
    op.setOperand(serviceLink);
    // Update the service link.
    ServiceLink[] mutatedServiceLinks = customerService.mutateServiceLinks(new ServiceLinkOperation[] { op });
    // Display the results.
    for (ServiceLink mutatedServiceLink : mutatedServiceLinks) {
        System.out.printf("Service link with service link ID %d, type '%s' updated to status: %s.%n", mutatedServiceLink.getServiceLinkId(), mutatedServiceLink.getServiceType(), mutatedServiceLink.getLinkStatus());
    }
}
Also used : CustomerServiceInterface(com.google.api.ads.adwords.axis.v201809.mcm.CustomerServiceInterface) ServiceLinkOperation(com.google.api.ads.adwords.axis.v201809.mcm.ServiceLinkOperation) ServiceLink(com.google.api.ads.adwords.axis.v201809.mcm.ServiceLink)

Aggregations

CustomerServiceInterface (com.google.api.ads.adwords.axis.v201809.mcm.CustomerServiceInterface)1 ServiceLink (com.google.api.ads.adwords.axis.v201809.mcm.ServiceLink)1 ServiceLinkOperation (com.google.api.ads.adwords.axis.v201809.mcm.ServiceLinkOperation)1