/// <summary> /// Initializes a new instance of this class with the specified <see cref="AuthorizationData"/> and <paramref name="apiEnvironment"/>. /// </summary> /// <param name="authorizationData">Represents a user who intends to access the corresponding customer and account. </param> /// <param name="apiEnvironment">Bing Ads API environment</param> public BulkServiceManager(AuthorizationData authorizationData, ApiEnvironment?apiEnvironment) { if (authorizationData == null) { throw new ArgumentNullException("authorizationData"); } _authorizationData = authorizationData; HttpService = new HttpService(); ZipExtractor = new ZipExtractor(); FileSystem = new FileSystem(); BulkFileReaderFactory = new BulkFileReaderFactory(); StatusPollIntervalInMilliseconds = DefaultStatusPollIntervalInMilliseconds; UploadHttpTimeout = TimeSpan.FromMilliseconds(DefaultHttpTimeoutInMillseconds); DownloadHttpTimeout = TimeSpan.FromMilliseconds(DefaultHttpTimeoutInMillseconds); WorkingDirectory = Path.Combine(Path.GetTempPath(), "BingAdsSDK"); if (apiEnvironment != null) { _apiEnvironment = apiEnvironment.Value; } }
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))); }
/// <summary> /// Initializes a new instance of this class with the specified <see cref="AuthorizationData"/>. /// </summary> /// <param name="authorizationData">Represents a user who intends to access the corresponding customer and account. </param> public BulkServiceManager(AuthorizationData authorizationData) { if (authorizationData == null) { throw new ArgumentNullException("authorizationData"); } _authorizationData = authorizationData; HttpService = new HttpService(); ZipExtractor = new ZipExtractor(); FileSystem = new FileSystem(); BulkFileReaderFactory = new BulkFileReaderFactory(); StatusPollIntervalInMilliseconds = DefaultStatusPollIntervalInMilliseconds; WorkingDirectory = Path.Combine(Path.GetTempPath(), "BingAdsSDK"); }
private async Task <IEnumerable <BulkEntity> > UploadEntitiesAsyncImpl(IProgress <BulkOperationProgressInfo> progress, CancellationToken cancellationToken, FileUploadParameters fileUploadParameters) { var resultFile = await UploadFileAsyncImpl(fileUploadParameters, progress, cancellationToken).ConfigureAwait(false); return(new BulkFileReaderEnumerable(BulkFileReaderFactory.CreateBulkFileReader(resultFile, ResultFileType.Upload, DownloadFileType.Csv))); }