Search in sources :

Example 6 with Proposal

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

the class CreateProposals method runExample.

/**
 * Runs the example.
 *
 * @param adManagerServices the services factory.
 * @param session the session.
 * @param primarySalespersonId the ID of the primary salesperson.
 * @param primaryTraffickerId the ID of the primary trafficker.
 * @param programmaticBuyerId the ID of the programmatic buyer. This can be obtained through the
 *     Programmatic_Buyer PQL table.
 * @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 primarySalespersonId, long primaryTraffickerId, long programmaticBuyerId) throws RemoteException {
    ProposalServiceInterface proposalService = adManagerServices.get(session, ProposalServiceInterface.class);
    Proposal proposal = new Proposal();
    // Setting required Marketplace information.
    ProposalMarketplaceInfo proposalMarketplaceInfo = new ProposalMarketplaceInfo();
    proposalMarketplaceInfo.setBuyerAccountId(programmaticBuyerId);
    // Set common required fields for a proposal.
    proposal.setName("Proposal #" + new Random().nextInt(Integer.MAX_VALUE));
    proposal.setPrimaryTraffickerId(primaryTraffickerId);
    proposal.setMarketplaceInfo(proposalMarketplaceInfo);
    SalespersonSplit primarySalesperson = new SalespersonSplit();
    primarySalesperson.setUserId(primarySalespersonId);
    proposal.setPrimarySalesperson(primarySalesperson);
    // Create the proposal on the server.
    Proposal[] proposals = proposalService.createProposals(new Proposal[] { proposal });
    for (Proposal createdProposal : proposals) {
        System.out.printf("A proposal with ID %d and name '%s' " + "was created.%n", createdProposal.getId(), createdProposal.getName());
    }
}
Also used : ProposalServiceInterface(com.google.api.ads.admanager.axis.v202205.ProposalServiceInterface) Random(java.util.Random) ProposalMarketplaceInfo(com.google.api.ads.admanager.axis.v202205.ProposalMarketplaceInfo) SalespersonSplit(com.google.api.ads.admanager.axis.v202205.SalespersonSplit) Proposal(com.google.api.ads.admanager.axis.v202205.Proposal)

Example 7 with Proposal

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

the class GetAllProposals 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 RemoteException {
    // Get the ProposalService.
    ProposalServiceInterface proposalService = adManagerServices.get(session, ProposalServiceInterface.class);
    // Create a statement to select all proposals.
    StatementBuilder statementBuilder = new StatementBuilder().orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
    // Default for total result set size.
    int totalResultSetSize = 0;
    do {
        // Get proposals by statement.
        ProposalPage page = proposalService.getProposalsByStatement(statementBuilder.toStatement());
        if (page.getResults() != null) {
            totalResultSetSize = page.getTotalResultSetSize();
            int i = page.getStartIndex();
            for (Proposal proposal : page.getResults()) {
                System.out.printf("%d) Proposal with ID %d and name '%s' was found.%n", i++, proposal.getId(), proposal.getName());
            }
        }
        statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
    } while (statementBuilder.getOffset() < totalResultSetSize);
    System.out.printf("Number of results found: %d%n", totalResultSetSize);
}
Also used : ProposalPage(com.google.api.ads.admanager.axis.v202205.ProposalPage) ProposalServiceInterface(com.google.api.ads.admanager.axis.v202205.ProposalServiceInterface) StatementBuilder(com.google.api.ads.admanager.axis.utils.v202205.StatementBuilder) Proposal(com.google.api.ads.admanager.axis.v202205.Proposal)

Example 8 with Proposal

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

the class GetMarketplaceComments method runExample.

/**
 * Runs the example.
 *
 * @param adManagerServices the services factory.
 * @param session the session.
 * @param proposalId the proposal 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 proposalId) throws RemoteException {
    ProposalServiceInterface proposalService = adManagerServices.get(session, ProposalServiceInterface.class);
    // Create a statement to select marketplace comments.
    StatementBuilder statementBuilder = new StatementBuilder().where("proposalId = :proposalId").withBindVariableValue("proposalId", proposalId);
    MarketplaceCommentPage page = proposalService.getMarketplaceCommentsByStatement(statementBuilder.toStatement());
    if (page.getResults() != null) {
        // Print out some information for each marketplace comment.
        int i = page.getStartIndex();
        for (MarketplaceComment marketplaceComment : page.getResults()) {
            System.out.printf("%d) Marketplace comment with creation time '%s' and comment '%s' was found.%n", i++, DateTimes.toString(marketplaceComment.getCreationTime()), marketplaceComment.getComment());
        }
    } else {
        System.out.println("No marketplace comments found.");
    }
}
Also used : MarketplaceCommentPage(com.google.api.ads.admanager.axis.v202205.MarketplaceCommentPage) ProposalServiceInterface(com.google.api.ads.admanager.axis.v202205.ProposalServiceInterface) StatementBuilder(com.google.api.ads.admanager.axis.utils.v202205.StatementBuilder) MarketplaceComment(com.google.api.ads.admanager.axis.v202205.MarketplaceComment)

Example 9 with Proposal

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

the class GetProposalsAwaitingSellerReview 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 RemoteException {
    ProposalServiceInterface proposalService = adManagerServices.get(session, ProposalServiceInterface.class);
    // Create a statement to select proposals.
    StatementBuilder statementBuilder = new StatementBuilder().where("negotiationStatus = :status").orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT).withBindVariableValue("status", NegotiationStatus.AWAITING_SELLER_REVIEW.toString());
    // Retrieve a small amount of proposals at a time, paging through
    // until all proposals have been retrieved.
    int totalResultSetSize = 0;
    do {
        ProposalPage page = proposalService.getProposalsByStatement(statementBuilder.toStatement());
        if (page.getResults() != null) {
            // Print out some information for each proposal.
            totalResultSetSize = page.getTotalResultSetSize();
            int i = page.getStartIndex();
            for (Proposal proposal : page.getResults()) {
                System.out.printf("%d) Proposal with ID %d and name '%s' was found.%n", i++, proposal.getId(), proposal.getName());
            }
        }
        statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
    } while (statementBuilder.getOffset() < totalResultSetSize);
    System.out.printf("Number of results found: %d%n", totalResultSetSize);
}
Also used : ProposalPage(com.google.api.ads.admanager.axis.v202205.ProposalPage) ProposalServiceInterface(com.google.api.ads.admanager.axis.v202205.ProposalServiceInterface) StatementBuilder(com.google.api.ads.admanager.axis.utils.v202205.StatementBuilder) Proposal(com.google.api.ads.admanager.axis.v202205.Proposal)

Example 10 with Proposal

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

the class GetProposalsAwaitingSellerReview 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 RemoteException {
    ProposalServiceInterface proposalService = adManagerServices.get(session, ProposalServiceInterface.class);
    // Create a statement to select proposals.
    StatementBuilder statementBuilder = new StatementBuilder().where("negotiationStatus = :status").orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT).withBindVariableValue("status", NegotiationStatus.AWAITING_SELLER_REVIEW.toString());
    // Retrieve a small amount of proposals at a time, paging through
    // until all proposals have been retrieved.
    int totalResultSetSize = 0;
    do {
        ProposalPage page = proposalService.getProposalsByStatement(statementBuilder.toStatement());
        if (page.getResults() != null) {
            // Print out some information for each proposal.
            totalResultSetSize = page.getTotalResultSetSize();
            int i = page.getStartIndex();
            for (Proposal proposal : page.getResults()) {
                System.out.printf("%d) Proposal with ID %d and name '%s' was found.%n", i++, proposal.getId(), proposal.getName());
            }
        }
        statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
    } while (statementBuilder.getOffset() < totalResultSetSize);
    System.out.printf("Number of results found: %d%n", totalResultSetSize);
}
Also used : ProposalPage(com.google.api.ads.admanager.axis.v202202.ProposalPage) ProposalServiceInterface(com.google.api.ads.admanager.axis.v202202.ProposalServiceInterface) StatementBuilder(com.google.api.ads.admanager.axis.utils.v202202.StatementBuilder) Proposal(com.google.api.ads.admanager.axis.v202202.Proposal)

Aggregations

StatementBuilder (com.google.api.ads.admanager.axis.utils.v202205.StatementBuilder)9 ProposalServiceInterface (com.google.api.ads.admanager.axis.v202205.ProposalServiceInterface)6 Observation (ca.nrc.cadc.caom2.Observation)5 Proposal (ca.nrc.cadc.caom2.Proposal)5 SimpleObservation (ca.nrc.cadc.caom2.SimpleObservation)5 Proposal (com.google.api.ads.admanager.axis.v202108.Proposal)5 ProposalServiceInterface (com.google.api.ads.admanager.axis.v202108.ProposalServiceInterface)5 Proposal (com.google.api.ads.admanager.axis.v202111.Proposal)5 ProposalServiceInterface (com.google.api.ads.admanager.axis.v202111.ProposalServiceInterface)5 Proposal (com.google.api.ads.admanager.axis.v202202.Proposal)5 ProposalServiceInterface (com.google.api.ads.admanager.axis.v202202.ProposalServiceInterface)5 Proposal (com.google.api.ads.admanager.axis.v202205.Proposal)5 ProposalLineItem (com.google.api.ads.admanager.axis.v202205.ProposalLineItem)5 ProposalLineItemServiceInterface (com.google.api.ads.admanager.axis.v202205.ProposalLineItemServiceInterface)5 Random (java.util.Random)5 Plane (ca.nrc.cadc.caom2.Plane)4 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202108.StatementBuilder)4 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202111.StatementBuilder)4 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202202.StatementBuilder)4 ProposalPage (com.google.api.ads.admanager.axis.v202108.ProposalPage)4