use of com.google.api.ads.admanager.axis.v202111.Location in project java-client by appium.
the class IOSDriverTest method geolocationTest.
@Test
public void geolocationTest() {
Location location = new Location(45, 45, 100);
driver.setLocation(location);
}
use of com.google.api.ads.admanager.axis.v202111.Location in project ddf by codice.
the class KmlModelToJtsPointConverterTest method assertKmlModelToJtsPoint.
static void assertKmlModelToJtsPoint(Model kmlModel, Point jtsPoint) {
assertThat(jtsPoint, notNullValue());
Location location = kmlModel.getLocation();
KmlToJtsCoordinateConverterTest.assertJtsCoordinatesFromKmlCoordinates(Collections.singletonList(new Coordinate(location.getLongitude(), location.getLatitude(), location.getAltitude())), jtsPoint.getCoordinates());
}
use of com.google.api.ads.admanager.axis.v202111.Location in project googleads-java-lib by googleads.
the class GetAllProgrammaticBuyers 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.
* @throws IOException if unable to write the response to a file.
*/
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws IOException {
// Get the PublisherQueryLanguageService.
PublisherQueryLanguageServiceInterface pqlService = adManagerServices.get(session, PublisherQueryLanguageServiceInterface.class);
// Create statement to select all programmatic buyers.
StatementBuilder statementBuilder = new StatementBuilder().select("BuyerAccountId, Name").from("Programmatic_Buyer").orderBy("BuyerAccountId ASC").offset(0).limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
// Default for result sets.
ResultSet combinedResultSet = null;
ResultSet resultSet;
int i = 0;
do {
// Get all programmatic buyers.
resultSet = pqlService.select(statementBuilder.toStatement());
// Combine result sets with previous ones.
combinedResultSet = combinedResultSet == null ? resultSet : Pql.combineResultSets(combinedResultSet, resultSet);
System.out.printf("%d) %d programmatic buyers beginning at offset %d were found.%n", i++, resultSet.getRows() == null ? 0 : resultSet.getRows().length, statementBuilder.getOffset());
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (resultSet.getRows() != null && resultSet.getRows().length > 0);
// Change to your file location.
String filePath = File.createTempFile("Programmatic-Buyers-", ".csv").toString();
// Write the result set to a CSV.
CsvFiles.writeCsv(Pql.resultSetToStringArrayList(combinedResultSet), filePath);
System.out.printf("Programmatic buyers saved to: %s%n", filePath);
}
use of com.google.api.ads.admanager.axis.v202111.Location in project googleads-java-lib by googleads.
the class GetLineItemsNamedLike 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.
* @throws IOException if unable to write the response to a file.
*/
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws IOException {
// Get the PublisherQueryLanguageService.
PublisherQueryLanguageServiceInterface pqlService = adManagerServices.get(session, PublisherQueryLanguageServiceInterface.class);
// Create statement to select all line items.
StatementBuilder statementBuilder = new StatementBuilder().select("Id, Name, Status").from("Line_Item").where("Name LIKE 'line item%'").orderBy("Id ASC").offset(0).limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
// Default for result sets.
ResultSet combinedResultSet = null;
ResultSet resultSet;
int i = 0;
do {
// Get line items like 'line item%'.
resultSet = pqlService.select(statementBuilder.toStatement());
// Combine result sets with previous ones.
combinedResultSet = combinedResultSet == null ? resultSet : Pql.combineResultSets(combinedResultSet, resultSet);
System.out.printf("%d) %d line items beginning at offset %d were found.%n", i++, resultSet.getRows() == null ? 0 : resultSet.getRows().length, statementBuilder.getOffset());
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (resultSet.getRows() != null && resultSet.getRows().length > 0);
// Change to your file location.
String filePath = File.createTempFile("Line-Items-Named-Like-", ".csv").toString();
// Write the result set to a CSV.
CsvFiles.writeCsv(Pql.resultSetToStringArrayList(combinedResultSet), filePath);
System.out.printf("Line items saved to: %s%n", filePath);
}
use of com.google.api.ads.admanager.axis.v202111.Location in project googleads-java-lib by googleads.
the class RunAdExchangeReport 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.
* @throws IOException if the report's contents could not be written to a temp file.
* @throws InterruptedException if the thread was interrupted while waiting for the report to be
* ready.
*/
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws IOException, InterruptedException {
// Get the ReportService.
ReportServiceInterface reportService = adManagerServices.get(session, ReportServiceInterface.class);
// Create report query.
ReportQuery reportQuery = new ReportQuery();
reportQuery.setDimensions(new Dimension[] { Dimension.AD_EXCHANGE_DATE, Dimension.AD_EXCHANGE_COUNTRY_NAME });
reportQuery.setColumns(new Column[] { Column.AD_EXCHANGE_AD_REQUESTS, Column.AD_EXCHANGE_IMPRESSIONS, Column.AD_EXCHANGE_ESTIMATED_REVENUE });
// Run in pacific time.
reportQuery.setTimeZoneType(TimeZoneType.AD_EXCHANGE);
reportQuery.setAdxReportCurrency("EUR");
// Set the dynamic date range type or a custom start and end date.
reportQuery.setDateRangeType(DateRangeType.YESTERDAY);
// Create report job.
ReportJob reportJob = new ReportJob();
reportJob.setReportQuery(reportQuery);
// Run report job.
reportJob = reportService.runReportJob(reportJob);
// Create report downloader.
ReportDownloader reportDownloader = new ReportDownloader(reportService, reportJob.getId());
// Wait for the report to be ready.
reportDownloader.waitForReportReady();
// Change to your file location.
File file = File.createTempFile("adexchange-report-", ".csv.gz");
System.out.printf("Downloading report to %s ...", file.toString());
// Download the report.
ReportDownloadOptions options = new ReportDownloadOptions();
options.setExportFormat(ExportFormat.CSV_DUMP);
options.setUseGzipCompression(true);
URL url = reportDownloader.getDownloadUrl(options);
Resources.asByteSource(url).copyTo(Files.asByteSink(file));
System.out.println("done.");
}
Aggregations