use of com.google.api.services.webmasters.model.SearchAnalyticsQueryResponse in project incubator-gobblin by apache.
the class GoogleWebmasterClientImpl method getPages.
@Override
public List<String> getPages(String siteProperty, String startDate, String endDate, String country, int rowLimit, List<GoogleWebmasterFilter.Dimension> requestedDimensions, List<ApiDimensionFilter> filters, int startRow) throws IOException {
checkRowLimit(rowLimit);
Preconditions.checkArgument(requestedDimensions.contains(GoogleWebmasterFilter.Dimension.PAGE));
SearchAnalyticsQueryResponse rspByCountry = createSearchAnalyticsQuery(siteProperty, startDate, endDate, requestedDimensions, GoogleWebmasterFilter.andGroupFilters(filters), rowLimit, startRow).execute();
List<ApiDataRow> pageRows = rspByCountry.getRows();
List<String> pages = new ArrayList<>(rowLimit);
if (pageRows != null) {
int pageIndex = requestedDimensions.indexOf(GoogleWebmasterFilter.Dimension.PAGE);
for (ApiDataRow row : pageRows) {
pages.add(row.getKeys().get(pageIndex));
}
}
return pages;
}
use of com.google.api.services.webmasters.model.SearchAnalyticsQueryResponse in project incubator-gobblin by apache.
the class GoogleWebmasterDataFetcherImpl method performSearchAnalyticsQueryInBatch.
@Override
public void performSearchAnalyticsQueryInBatch(List<ProducerJob> jobs, List<ArrayList<ApiDimensionFilter>> filterList, List<JsonBatchCallback<SearchAnalyticsQueryResponse>> callbackList, List<Dimension> requestedDimensions, int rowLimit) throws IOException {
BatchRequest batchRequest = _client.createBatch();
for (int i = 0; i < jobs.size(); ++i) {
ProducerJob job = jobs.get(i);
ArrayList<ApiDimensionFilter> filters = filterList.get(i);
JsonBatchCallback<SearchAnalyticsQueryResponse> callback = callbackList.get(i);
_client.createSearchAnalyticsQuery(_siteProperty, job.getStartDate(), job.getEndDate(), requestedDimensions, GoogleWebmasterFilter.andGroupFilters(filters), rowLimit, 0).queue(batchRequest, callback);
}
batchRequest.execute();
}
Aggregations