use of com.google.api.ads.admanager.axis.v202111.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