Search in sources :

Example 1 with ThirdPartyDataDeclaration

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

the class GetDefaultThirdPartyDataDeclaration 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 Exception {
    // Get the NetworkService.
    NetworkServiceInterface networkService = adManagerServices.get(session, NetworkServiceInterface.class);
    // Get the PublisherQueryLanguageService.
    PublisherQueryLanguageServiceInterface pqlService = adManagerServices.get(session, PublisherQueryLanguageServiceInterface.class);
    // Get the current network's default third party data declaration.
    ThirdPartyDataDeclaration declaration = networkService.getDefaultThirdPartyDataDeclaration();
    if (declaration == null) {
        System.out.println("No default ad technology partners have been set on this network.");
    } else if (DeclarationType.NONE.equals(declaration.getDeclarationType()) || declaration.getThirdPartyCompanyIds().length == 0) {
        System.out.println("This network has specified that there are no ad technology providers " + " associated with its reservation creatives by default.");
    } else {
        System.out.printf("This network has specified %d ad technology provider(s) associated with its reservation" + " creatives by default:%n", declaration.getThirdPartyCompanyIds().length);
        ResultSet companies = pqlService.select(new StatementBuilder().select("name, id").from("rich_media_ad_company").where("id in (:ids)").withBindVariableValue("ids", ImmutableSet.copyOf(Longs.asList(declaration.getThirdPartyCompanyIds()))).toStatement());
        System.out.println(Pql.resultSetToString(companies));
    }
}
Also used : PublisherQueryLanguageServiceInterface(com.google.api.ads.admanager.axis.v202111.PublisherQueryLanguageServiceInterface) NetworkServiceInterface(com.google.api.ads.admanager.axis.v202111.NetworkServiceInterface) ThirdPartyDataDeclaration(com.google.api.ads.admanager.axis.v202111.ThirdPartyDataDeclaration) StatementBuilder(com.google.api.ads.admanager.axis.utils.v202111.StatementBuilder) ResultSet(com.google.api.ads.admanager.axis.v202111.ResultSet)

Example 2 with ThirdPartyDataDeclaration

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

the class GetDefaultThirdPartyDataDeclaration 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 Exception {
    // Get the NetworkService.
    NetworkServiceInterface networkService = adManagerServices.get(session, NetworkServiceInterface.class);
    // Get the PublisherQueryLanguageService.
    PublisherQueryLanguageServiceInterface pqlService = adManagerServices.get(session, PublisherQueryLanguageServiceInterface.class);
    // Get the current network's default third party data declaration.
    ThirdPartyDataDeclaration declaration = networkService.getDefaultThirdPartyDataDeclaration();
    if (declaration == null) {
        System.out.println("No default ad technology partners have been set on this network.");
    } else if (DeclarationType.NONE.equals(declaration.getDeclarationType()) || declaration.getThirdPartyCompanyIds().length == 0) {
        System.out.println("This network has specified that there are no ad technology providers " + " associated with its reservation creatives by default.");
    } else {
        System.out.printf("This network has specified %d ad technology provider(s) associated with its reservation" + " creatives by default:%n", declaration.getThirdPartyCompanyIds().length);
        ResultSet companies = pqlService.select(new StatementBuilder().select("name, id").from("rich_media_ad_company").where("id in (:ids)").withBindVariableValue("ids", ImmutableSet.copyOf(Longs.asList(declaration.getThirdPartyCompanyIds()))).toStatement());
        System.out.println(Pql.resultSetToString(companies));
    }
}
Also used : PublisherQueryLanguageServiceInterface(com.google.api.ads.admanager.axis.v202205.PublisherQueryLanguageServiceInterface) NetworkServiceInterface(com.google.api.ads.admanager.axis.v202205.NetworkServiceInterface) ThirdPartyDataDeclaration(com.google.api.ads.admanager.axis.v202205.ThirdPartyDataDeclaration) StatementBuilder(com.google.api.ads.admanager.axis.utils.v202205.StatementBuilder) ResultSet(com.google.api.ads.admanager.axis.v202205.ResultSet)

Example 3 with ThirdPartyDataDeclaration

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

the class GetDefaultThirdPartyDataDeclaration 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 Exception {
    // Get the NetworkService.
    NetworkServiceInterface networkService = adManagerServices.get(session, NetworkServiceInterface.class);
    // Get the PublisherQueryLanguageService.
    PublisherQueryLanguageServiceInterface pqlService = adManagerServices.get(session, PublisherQueryLanguageServiceInterface.class);
    // Get the current network's default third party data declaration.
    ThirdPartyDataDeclaration declaration = networkService.getDefaultThirdPartyDataDeclaration();
    if (declaration == null) {
        System.out.println("No default ad technology partners have been set on this network.");
    } else if (DeclarationType.NONE.equals(declaration.getDeclarationType()) || declaration.getThirdPartyCompanyIds().length == 0) {
        System.out.println("This network has specified that there are no ad technology providers " + " associated with its reservation creatives by default.");
    } else {
        System.out.printf("This network has specified %d ad technology provider(s) associated with its reservation" + " creatives by default:%n", declaration.getThirdPartyCompanyIds().length);
        ResultSet companies = pqlService.select(new StatementBuilder().select("name, id").from("rich_media_ad_company").where("id in (:ids)").withBindVariableValue("ids", ImmutableSet.copyOf(Longs.asList(declaration.getThirdPartyCompanyIds()))).toStatement());
        System.out.println(Pql.resultSetToString(companies));
    }
}
Also used : PublisherQueryLanguageServiceInterface(com.google.api.ads.admanager.axis.v202108.PublisherQueryLanguageServiceInterface) NetworkServiceInterface(com.google.api.ads.admanager.axis.v202108.NetworkServiceInterface) ThirdPartyDataDeclaration(com.google.api.ads.admanager.axis.v202108.ThirdPartyDataDeclaration) StatementBuilder(com.google.api.ads.admanager.axis.utils.v202108.StatementBuilder) ResultSet(com.google.api.ads.admanager.axis.v202108.ResultSet)

Example 4 with ThirdPartyDataDeclaration

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

the class GetDefaultThirdPartyDataDeclaration 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 Exception {
    // Get the NetworkService.
    NetworkServiceInterface networkService = adManagerServices.get(session, NetworkServiceInterface.class);
    // Get the PublisherQueryLanguageService.
    PublisherQueryLanguageServiceInterface pqlService = adManagerServices.get(session, PublisherQueryLanguageServiceInterface.class);
    // Get the current network's default third party data declaration.
    ThirdPartyDataDeclaration declaration = networkService.getDefaultThirdPartyDataDeclaration();
    if (declaration == null) {
        System.out.println("No default ad technology partners have been set on this network.");
    } else if (DeclarationType.NONE.equals(declaration.getDeclarationType()) || declaration.getThirdPartyCompanyIds().length == 0) {
        System.out.println("This network has specified that there are no ad technology providers " + " associated with its reservation creatives by default.");
    } else {
        System.out.printf("This network has specified %d ad technology provider(s) associated with its reservation" + " creatives by default:%n", declaration.getThirdPartyCompanyIds().length);
        ResultSet companies = pqlService.select(new StatementBuilder().select("name, id").from("rich_media_ad_company").where("id in (:ids)").withBindVariableValue("ids", ImmutableSet.copyOf(Longs.asList(declaration.getThirdPartyCompanyIds()))).toStatement());
        System.out.println(Pql.resultSetToString(companies));
    }
}
Also used : PublisherQueryLanguageServiceInterface(com.google.api.ads.admanager.axis.v202202.PublisherQueryLanguageServiceInterface) NetworkServiceInterface(com.google.api.ads.admanager.axis.v202202.NetworkServiceInterface) ThirdPartyDataDeclaration(com.google.api.ads.admanager.axis.v202202.ThirdPartyDataDeclaration) StatementBuilder(com.google.api.ads.admanager.axis.utils.v202202.StatementBuilder) ResultSet(com.google.api.ads.admanager.axis.v202202.ResultSet)

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 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202205.StatementBuilder)1 NetworkServiceInterface (com.google.api.ads.admanager.axis.v202108.NetworkServiceInterface)1 PublisherQueryLanguageServiceInterface (com.google.api.ads.admanager.axis.v202108.PublisherQueryLanguageServiceInterface)1 ResultSet (com.google.api.ads.admanager.axis.v202108.ResultSet)1 ThirdPartyDataDeclaration (com.google.api.ads.admanager.axis.v202108.ThirdPartyDataDeclaration)1 NetworkServiceInterface (com.google.api.ads.admanager.axis.v202111.NetworkServiceInterface)1 PublisherQueryLanguageServiceInterface (com.google.api.ads.admanager.axis.v202111.PublisherQueryLanguageServiceInterface)1 ResultSet (com.google.api.ads.admanager.axis.v202111.ResultSet)1 ThirdPartyDataDeclaration (com.google.api.ads.admanager.axis.v202111.ThirdPartyDataDeclaration)1 NetworkServiceInterface (com.google.api.ads.admanager.axis.v202202.NetworkServiceInterface)1 PublisherQueryLanguageServiceInterface (com.google.api.ads.admanager.axis.v202202.PublisherQueryLanguageServiceInterface)1 ResultSet (com.google.api.ads.admanager.axis.v202202.ResultSet)1 ThirdPartyDataDeclaration (com.google.api.ads.admanager.axis.v202202.ThirdPartyDataDeclaration)1 NetworkServiceInterface (com.google.api.ads.admanager.axis.v202205.NetworkServiceInterface)1 PublisherQueryLanguageServiceInterface (com.google.api.ads.admanager.axis.v202205.PublisherQueryLanguageServiceInterface)1 ResultSet (com.google.api.ads.admanager.axis.v202205.ResultSet)1 ThirdPartyDataDeclaration (com.google.api.ads.admanager.axis.v202205.ThirdPartyDataDeclaration)1