use of com.google.api.ads.admanager.axis.v202205.ReportJobStatus in project googleads-java-lib by googleads.
the class ReportDownloader method getDownloadUrl.
/**
* Gets the download URL for a GZip or plain-text format report. If you requested a compressed
* report, you may want to save your file with a gz or zip extension.
*
* <pre><code>
* URL url = reportDownloader.getDownloadUrl(options);
* Resources.asByteSource(url).copyTo(Files.asByteSink(file));
* </code></pre>
*
* @param options the options to download the report with
* @return the URL for the report download
* @throws RemoteException if there was an error performing any Axis call
* @throws MalformedURLException if there is an error forming the download URL
* @throws IllegalStateException if the report is not ready to be downloaded
*/
public URL getDownloadUrl(ReportDownloadOptions options) throws RemoteException, MalformedURLException {
ReportJobStatus status = reportService.getReportJobStatus(reportJobId);
Preconditions.checkState(status == ReportJobStatus.COMPLETED, "Report " + reportJobId + " must be completed before downloading. It is currently: " + status);
return new URL(reportService.getReportDownloadUrlWithOptions(reportJobId, options));
}
use of com.google.api.ads.admanager.axis.v202205.ReportJobStatus in project googleads-java-lib by googleads.
the class ReportDownloader method waitForReportReady.
/**
* Blocks and waits for a report to be ready. When a {@link ReportJobStatus} is received that is
* not {@code ReportJobStatus#Pending} or {@code ReportJobStatus#InProgress}, the report is
* considered finished, and the method is returned with a {@code true} if the report was
* successful, or an {@code false} if not.
*
* @return {@code true} if the report was successful, {@code false} otherwise
* @throws RemoteException if there was an error performing one of the SOAP calls
* @throws InterruptedException if the thread was interrupted
*/
public boolean waitForReportReady() throws RemoteException, InterruptedException {
ReportJobStatus status = reportService.getReportJobStatus(reportJobId);
while (status == ReportJobStatus.IN_PROGRESS) {
sleeper.sleep(SLEEP_TIMER);
status = reportService.getReportJobStatus(reportJobId);
}
return status == ReportJobStatus.COMPLETED;
}
use of com.google.api.ads.admanager.axis.v202205.ReportJobStatus in project googleads-java-lib by googleads.
the class ReportDownloader method waitForReportReady.
/**
* Blocks and waits for a report to be ready. When a {@link ReportJobStatus} is received that is
* not {@code ReportJobStatus#Pending} or {@code ReportJobStatus#InProgress}, the report is
* considered finished, and the method is returned with a {@code true} if the report was
* successful, or an {@code false} if not.
*
* @return {@code true} if the report was successful, {@code false} otherwise
* @throws ApiException_Exception if there was an error performing one of the SOAP calls
* @throws InterruptedException if the thread was interrupted
*/
public boolean waitForReportReady() throws InterruptedException, ApiException_Exception {
ReportJobStatus status = reportService.getReportJobStatus(reportJobId);
while (status == ReportJobStatus.IN_PROGRESS) {
Thread.sleep(SLEEP_TIMER);
status = reportService.getReportJobStatus(reportJobId);
}
return status == ReportJobStatus.COMPLETED;
}
use of com.google.api.ads.admanager.axis.v202205.ReportJobStatus in project googleads-java-lib by googleads.
the class ReportDownloader method getDownloadUrl.
/**
* Gets the download URL for a GZip or plain-text format report. If you requested a compressed
* report, you may want to save your file with a gz or zip extension.
*
* <pre><code>
* URL url = new URL(reportDownloader.getDownloadUrl(options));
* Resources.asByteSource(url).copyTo(Files.asByteSink(file));
* </code></pre>
*
* @param options the options to download the report with
* @return the URL for the report download
* @throws ApiException_Exception if there was an error performing any jaxws call
* @throws MalformedURLException if there is an error forming the download URL
* @throws IllegalStateException if the report is not ready to be downloaded
*/
public URL getDownloadUrl(ReportDownloadOptions options) throws ApiException_Exception, MalformedURLException {
ReportJobStatus status = reportService.getReportJobStatus(reportJobId);
Preconditions.checkState(status == ReportJobStatus.COMPLETED, "Report " + reportJobId + " must be completed before downloading. It is currently: " + status);
return new URL(reportService.getReportDownloadUrlWithOptions(reportJobId, options));
}
use of com.google.api.ads.admanager.axis.v202205.ReportJobStatus in project googleads-java-lib by googleads.
the class ReportDownloader method getDownloadUrl.
/**
* Gets the download URL for a GZip or plain-text format report. If you requested a compressed
* report, you may want to save your file with a gz or zip extension.
*
* <pre><code>
* URL url = new URL(reportDownloader.getDownloadUrl(options));
* Resources.asByteSource(url).copyTo(Files.asByteSink(file));
* </code></pre>
*
* @param options the options to download the report with
* @return the URL for the report download
* @throws ApiException_Exception if there was an error performing any jaxws call
* @throws MalformedURLException if there is an error forming the download URL
* @throws IllegalStateException if the report is not ready to be downloaded
*/
public URL getDownloadUrl(ReportDownloadOptions options) throws ApiException_Exception, MalformedURLException {
ReportJobStatus status = reportService.getReportJobStatus(reportJobId);
Preconditions.checkState(status == ReportJobStatus.COMPLETED, "Report " + reportJobId + " must be completed before downloading. It is currently: " + status);
return new URL(reportService.getReportDownloadUrlWithOptions(reportJobId, options));
}
Aggregations