Example #1
0
        private async Task <IEnumerable <BulkEntity> > DownloadEntitiesAsyncImpl(DownloadParameters parameters, IProgress <BulkOperationProgressInfo> progress, CancellationToken cancellationToken)
        {
            var resultFile = await DownloadFileAsyncImpl(parameters, progress, cancellationToken).ConfigureAwait(false);

            var resultFileType = parameters.LastSyncTimeInUTC == null ? ResultFileType.FullDownload : ResultFileType.PartialDownload;

            return(new BulkFileReaderEnumerable(BulkFileReaderFactory.CreateBulkFileReader(resultFile, resultFileType, parameters.FileType)));
        }
Example #2
0
        /// <summary>
        /// Downloads the specified Bulk 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="DownloadParameters"/> for more information about available parameters.</param>
        /// <param name="progress">A class implementing <see cref="IProgress{T}"/> for tracking the percent complete progress information for the bulk operation.</param>
        /// <param name="cancellationToken">Cancellation token that can be used to cancel the tracking of the bulk operation on the client. Doesn't cancel the actual bulk operation on the server.</param>
        /// <returns>A task that represents the asynchronous operation. The task result will be the local bulk 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="BulkOperationCouldNotBeCompletedException{TStatus}">Thrown if the bulk operation has failed </exception>
        public Task <string> DownloadFileAsync(DownloadParameters parameters, IProgress <BulkOperationProgressInfo> progress, CancellationToken cancellationToken)
        {
            ValidateUserData();

            ValidateSubmitDownloadParameters(parameters.SubmitDownloadParameters);

            return(DownloadFileAsyncImpl(parameters, progress, cancellationToken));
        }
Example #3
0
        /// <summary>
        /// Downloads the specified Bulk entities.
        /// </summary>
        /// <param name="parameters">Determines various download parameters, for example what entities to download. Please see <see cref="DownloadParameters"/> for more information about available parameters.</param>
        /// <param name="progress">A class implementing <see cref="IProgress{T}"/> for tracking the percent complete progress information for the bulk operation.</param>
        /// <param name="cancellationToken">Cancellation token that can be used to cancel the tracking of the bulk operation on the client. Doesn't cancel the actual bulk operation on the server.</param>
        /// <returns>A task that represents the asynchronous operation. The task result will be an enumerable list of <see cref="BulkEntity"/> objects.</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="BulkOperationCouldNotBeCompletedException{TStatus}">Thrown if the bulk operation has failed.</exception>
        public Task <IEnumerable <BulkEntity> > DownloadEntitiesAsync(DownloadParameters parameters, IProgress <BulkOperationProgressInfo> progress, CancellationToken cancellationToken)
        {
            ValidateSubmitDownloadParameters(parameters.SubmitDownloadParameters);

            ValidateUserData();

            return(DownloadEntitiesAsyncImpl(parameters, progress, cancellationToken));
        }
Example #4
0
        private async Task <string> DownloadFileAsyncImpl(DownloadParameters parameters, IProgress <BulkOperationProgressInfo> progress, CancellationToken cancellationToken)
        {
            using (var operation = await SubmitDownloadAsyncImpl(parameters.SubmitDownloadParameters).ConfigureAwait(false))
            {
                await operation.TrackAsync(progress, cancellationToken).ConfigureAwait(false);

                return(await DownloadBulkFile(parameters.ResultFileDirectory, parameters.ResultFileName, parameters.OverwriteResultFile, operation).ConfigureAwait(false));
            }
        }
Example #5
0
 /// <summary>
 /// Downloads the specified Bulk 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="DownloadParameters"/> for more information about available parameters.</param>
 /// <returns>A task that represents the asynchronous operation. The task result will be the local bulk 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="BulkOperationCouldNotBeCompletedException{TStatus}">Thrown if the bulk operation has failed </exception>
 public Task <string> DownloadFileAsync(DownloadParameters parameters)
 {
     return(DownloadFileAsync(parameters, null, CancellationToken.None));
 }
Example #6
0
 /// <summary>
 /// Downloads the specified Bulk entities.
 /// </summary>
 /// <param name="parameters">Determines various download parameters, for example what entities to download. Please see <see cref="DownloadParameters"/> for more information about available parameters.</param>
 /// <returns>A task that represents the asynchronous operation. The task result will be an enumerable list of <see cref="BulkEntity"/> objects.</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="BulkOperationCouldNotBeCompletedException{TStatus}">Thrown if the bulk operation has failed.</exception>
 public Task <IEnumerable <BulkEntity> > DownloadEntitiesAsync(DownloadParameters parameters)
 {
     return(DownloadEntitiesAsync(parameters, null, CancellationToken.None));
 }