use of com.google.api.ads.admanager.axis.v202205.Statement in project googleads-java-lib by googleads.
the class GetProposalLineItemsForProposal method runExample.
/**
* Runs the example.
*
* @param adManagerServices the services factory.
* @param session the session.
* @param proposalId the ID of the proposal.
* @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 {
ProposalLineItemServiceInterface proposalLineItemService = adManagerServices.get(session, ProposalLineItemServiceInterface.class);
// Create a statement to select proposal line items.
StatementBuilder statementBuilder = new StatementBuilder().where("proposalId = :proposalId").orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT).withBindVariableValue("proposalId", proposalId);
// Retrieve a small amount of proposal line items at a time, paging through
// until all proposal line items have been retrieved.
int totalResultSetSize = 0;
do {
ProposalLineItemPage page = proposalLineItemService.getProposalLineItemsByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
// Print out some information for each proposal line item.
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (ProposalLineItem proposalLineItem : page.getResults()) {
System.out.printf("%d) Proposal line item with ID %d and name '%s' was found.%n", i++, proposalLineItem.getId(), proposalLineItem.getName());
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
}
use of com.google.api.ads.admanager.axis.v202205.Statement 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);
}
use of com.google.api.ads.admanager.axis.v202205.Statement 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.");
}
}
use of com.google.api.ads.admanager.axis.v202205.Statement 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);
}
use of com.google.api.ads.admanager.axis.v202205.Statement in project googleads-java-lib by googleads.
the class GetAllSuggestedAdUnits 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 SuggestedAdUnitService.
SuggestedAdUnitServiceInterface suggestedAdUnitService = adManagerServices.get(session, SuggestedAdUnitServiceInterface.class);
// Create a statement to select all suggested ad units.
StatementBuilder statementBuilder = new StatementBuilder().orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get suggested ad units by statement.
SuggestedAdUnitPage page = suggestedAdUnitService.getSuggestedAdUnitsByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (SuggestedAdUnit suggestedAdUnit : page.getResults()) {
System.out.printf("%d) Suggested ad unit with ID '%s', path '%s', " + "and number of requests %d was found.%n", i++, suggestedAdUnit.getId(), Joiner.on('/').join(suggestedAdUnit.getPath()), suggestedAdUnit.getNumRequests());
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
}
Aggregations