コード例 #1
0
        private async Task <string> DownloadFileAsyncImpl(ReportingDownloadParameters parameters, CancellationToken cancellationToken)
        {
            using (var operation = await SubmitDownloadAsyncImpl(parameters.ReportRequest).ConfigureAwait(false))
            {
                await operation.TrackAsync(cancellationToken).ConfigureAwait(false);

                return(await DownloadReportingFile(parameters.ResultFileDirectory, parameters.ResultFileName, parameters.OverwriteResultFile, operation).ConfigureAwait(false));
            }
        }
コード例 #2
0
 /// <summary>
 /// Downloads the reporting file to a Report Object in async mode.
 /// </summary>
 /// <param name="parameters">Determines various download parameters, for example what entities to download and where the file should be downloaded.
 /// Please see <see cref="ReportingDownloadParameters"/> for more information about available parameters.</param>
 /// <param name="cancellationToken">Cancellation token that can be used to cancel the tracking of the reporting operation on the client. Doesn't cancel the actual reporting operation on the server.</param>
 /// <returns>A task that represents the asynchronous operation. The task result will be return a Object of Report.</returns>
 /// <exception cref="FaultException{TDetail}">Thrown if a fault is returned from the Bing Ads service.</exception>
 /// <exception cref="OAuthTokenRequestException">Thrown if tokens can't be refreshed due to an error received from the Microsoft Account authorization server.</exception>
 /// <exception cref="ReportingOperationCouldNotBeCompletedException">Thrown if the reporting operation has failed </exception>
 public Task <Report> DownloadReportAsync(ReportingDownloadParameters parameters,
                                          CancellationToken cancellationToken)
 {
     return(DownloadReportAsyncImpl(parameters, cancellationToken));
 }
コード例 #3
0
        private async Task <Report> DownloadReportAsyncImpl(ReportingDownloadParameters parameters, CancellationToken cancellationToken)
        {
            var resultFile = await this.DownloadFileAsyncImpl(parameters, cancellationToken).ConfigureAwait(false);

            return(resultFile != null ? new ReportFileReader(resultFile, parameters.ReportRequest.Format.GetValueOrDefault()).GetReport() : null);
        }
コード例 #4
0
 /// <summary>
 /// Downloads the specified reporting entities to a local file.
 /// </summary>
 /// <param name="parameters">Determines various download parameters, for example what entities to download and where the file should be downloaded.
 /// Please see <see cref="ReportingDownloadParameters"/> for more information about available parameters.</param>
 /// <returns>A task that represents the asynchronous operation. The task result will be the local reporting file path.</returns>
 /// <exception cref="FaultException{TDetail}">Thrown if a fault is returned from the Bing Ads service.</exception>
 /// <exception cref="OAuthTokenRequestException">Thrown if tokens can't be refreshed due to an error received from the Microsoft Account authorization server.</exception>
 /// <exception cref="ReportingOperationCouldNotBeCompletedException">Thrown if the reporting operation has failed </exception>
 public Task <string> DownloadFileAsync(ReportingDownloadParameters parameters)
 {
     return(DownloadFileAsync(parameters, CancellationToken.None));
 }