From 0a39dca4134387bbd06539c612b81540094107aa Mon Sep 17 00:00:00 2001 From: Robert Gabor Date: Thu, 7 Nov 2024 11:55:37 +0100 Subject: [PATCH 1/3] feat: Added transfer options to all transfer types. --- ...Relativity.Transfer.SDK.Samples.CLI.csproj | 14 +++++----- ...elativity.Transfer.SDK.Samples.Core.csproj | 12 ++++---- .../FullPathWorkflow/DownloadDirectory.cs | 9 +++++- .../FullPathWorkflow/DownloadFile.cs | 11 ++++++-- ...tingUpProgressHandlerAndPrintingSummary.cs | 11 ++++++-- .../FullPathWorkflow/UploadDirectory.cs | 11 ++++++-- .../FullPathWorkflow/UploadFile.cs | 11 ++++++-- .../FullPathWorkflow/UploadItems.cs | 11 ++++++-- ...UploadToFileSharePathBasedOnWorkspaceId.cs | 9 +++++- .../JobBasedWorkflow/DownloadDirectory.cs | 13 +++++++-- .../DownloadDirectoryBasedOnExistingJob.cs | 28 ++++++++++++++----- .../JobBasedWorkflow/UploadDirectory.cs | 13 +++++++-- .../UploadDirectoryBasedOnExistingJob.cs | 13 +++++++-- .../JobBasedWorkflow/UploadItems.cs | 11 ++++++-- 14 files changed, 134 insertions(+), 43 deletions(-) diff --git a/Source/Relativity.Transfer.SDK.Samples.CLI/Relativity.Transfer.SDK.Samples.CLI.csproj b/Source/Relativity.Transfer.SDK.Samples.CLI/Relativity.Transfer.SDK.Samples.CLI.csproj index 1990c8a..9d5100f 100644 --- a/Source/Relativity.Transfer.SDK.Samples.CLI/Relativity.Transfer.SDK.Samples.CLI.csproj +++ b/Source/Relativity.Transfer.SDK.Samples.CLI/Relativity.Transfer.SDK.Samples.CLI.csproj @@ -2,19 +2,19 @@ Exe - net462;net6.0 + net6.0;net462 10.0 - - - - - - + + + + + + diff --git a/Source/Relativity.Transfer.SDK.Samples.Core/Relativity.Transfer.SDK.Samples.Core.csproj b/Source/Relativity.Transfer.SDK.Samples.Core/Relativity.Transfer.SDK.Samples.Core.csproj index b61788d..f4b6066 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Core/Relativity.Transfer.SDK.Samples.Core.csproj +++ b/Source/Relativity.Transfer.SDK.Samples.Core/Relativity.Transfer.SDK.Samples.Core.csproj @@ -8,13 +8,13 @@ - - - - - + + + + + - + diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/DownloadDirectory.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/DownloadDirectory.cs index 538e009..c19d01b 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/DownloadDirectory.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/DownloadDirectory.cs @@ -1,5 +1,6 @@ using System.Threading; using System.Threading.Tasks; +using Relativity.Transfer.SDK.Interfaces.Options; using Relativity.Transfer.SDK.Interfaces.Paths; using Relativity.Transfer.SDK.Samples.Core.Attributes; using Relativity.Transfer.SDK.Samples.Core.Authentication; @@ -41,6 +42,12 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to : new DirectoryPath(configuration.DownloadDirectory.Source); var destination = _pathExtension.EnsureLocalDirectory(configuration.DownloadDirectory.Destination); var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + var downloadDirectoryOptions = new DownloadDirectoryOptions() + { + MaximumSpeed = default, + OverwritePolicy = default, + // ... + }; var progressHandler = _progressHandlerFactory.Create(); // The builder follows the Fluent convention, and more options will be added in the future. The only required component (besides the client name) @@ -54,7 +61,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to _consoleLogger.PrintCreatingTransfer(jobId, source, destination); var result = await transferClient - .DownloadDirectoryAsync(jobId, source, destination, progressHandler, token) + .DownloadDirectoryAsync(jobId, source, destination, downloadDirectoryOptions, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(result); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/DownloadFile.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/DownloadFile.cs index b527e72..a3a22ce 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/DownloadFile.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/DownloadFile.cs @@ -1,5 +1,6 @@ using System.Threading; using System.Threading.Tasks; +using Relativity.Transfer.SDK.Interfaces.Options; using Relativity.Transfer.SDK.Interfaces.Paths; using Relativity.Transfer.SDK.Samples.Core.Attributes; using Relativity.Transfer.SDK.Samples.Core.Authentication; @@ -38,7 +39,13 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to var jobId = configuration.Common.JobId; var source = new FilePath(configuration.DownloadFile.Source); var destination = _pathExtension.EnsureLocalDirectory(configuration.DownloadFile.Destination); - var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + var downloadFileOptions = new DownloadFileOptions() + { + MaximumSpeed = default, + OverwritePolicy = default, + // ... + }; var progressHandler = _progressHandlerFactory.Create(); // The builder follows the Fluent convention, and more options will be added in the future. The only required component (besides the client name) @@ -52,7 +59,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to _consoleLogger.PrintCreatingTransfer(jobId, source, destination); var result = await transferClient - .DownloadFileAsync(jobId, source, destination, progressHandler, token) + .DownloadFileAsync(jobId, source, destination, downloadFileOptions, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(result); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/SettingUpProgressHandlerAndPrintingSummary.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/SettingUpProgressHandlerAndPrintingSummary.cs index 41d9e3c..b1e1267 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/SettingUpProgressHandlerAndPrintingSummary.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/SettingUpProgressHandlerAndPrintingSummary.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using ByteSizeLib; using Relativity.Transfer.SDK.Core.ProgressReporting; +using Relativity.Transfer.SDK.Interfaces.Options; using Relativity.Transfer.SDK.Interfaces.Paths; using Relativity.Transfer.SDK.Interfaces.ProgressReporting; using Relativity.Transfer.SDK.Samples.Core.Attributes; @@ -47,7 +48,13 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to : string.Empty; var destination = string.IsNullOrWhiteSpace(configuration.UploadDirectory.Destination) ? _pathExtension.GetDefaultRemoteDirectoryPathForUpload(configuration.Common) - : new DirectoryPath(configuration.UploadDirectory.Destination); + : new DirectoryPath(configuration.UploadDirectory.Destination); + var uploadDirectoryOptions = new UploadDirectoryOptions() + { + MaximumSpeed = default, + OverwritePolicy = default, + // ... + }; var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); // The builder follows the Fluent convention, and more options will be added in the future. The only required component (besides the client name) @@ -61,7 +68,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to _consoleLogger.PrintCreatingTransfer(jobId, source, destination, additionalLine); var result = await transferClient - .UploadDirectoryAsync(jobId, source, destination, GetProgressHandler(), default) + .UploadDirectoryAsync(jobId, source, destination, uploadDirectoryOptions, GetProgressHandler(), default) .ConfigureAwait(false); PrintTransferSummary(result); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadDirectory.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadDirectory.cs index a5db7b1..e756caf 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadDirectory.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadDirectory.cs @@ -1,5 +1,6 @@ using System.Threading; using System.Threading.Tasks; +using Relativity.Transfer.SDK.Interfaces.Options; using Relativity.Transfer.SDK.Interfaces.Paths; using Relativity.Transfer.SDK.Samples.Core.Attributes; using Relativity.Transfer.SDK.Samples.Core.Authentication; @@ -40,7 +41,13 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to var destination = string.IsNullOrWhiteSpace(configuration.UploadDirectory.Destination) ? _pathExtension.GetDefaultRemoteDirectoryPathForUpload(configuration.Common) : new DirectoryPath(configuration.UploadDirectory.Destination); - var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + var uploadDirectoryOptions = new UploadDirectoryOptions() + { + MaximumSpeed = default, + OverwritePolicy = default, + // ... + }; var progressHandler = _progressHandlerFactory.Create(); // The builder follows the Fluent convention, and more options will be added in the future. The only required component (besides the client name) @@ -54,7 +61,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to _consoleLogger.PrintCreatingTransfer(jobId, source, destination); var result = await transferClient - .UploadDirectoryAsync(jobId, source, destination, progressHandler, token) + .UploadDirectoryAsync(jobId, source, destination, uploadDirectoryOptions, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(result); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadFile.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadFile.cs index 2d9614d..4fe1d5e 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadFile.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadFile.cs @@ -1,5 +1,6 @@ using System.Threading; using System.Threading.Tasks; +using Relativity.Transfer.SDK.Interfaces.Options; using Relativity.Transfer.SDK.Interfaces.Paths; using Relativity.Transfer.SDK.Samples.Core.Attributes; using Relativity.Transfer.SDK.Samples.Core.Authentication; @@ -40,7 +41,13 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to var destination = string.IsNullOrWhiteSpace(configuration.UploadFile.Destination) ? _pathExtension.GetDefaultRemoteDirectoryPathForUpload(configuration.Common) : new DirectoryPath(configuration.UploadFile.Destination); - var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + var uploadFileOptions = new UploadFileOptions() + { + MaximumSpeed = default, + OverwritePolicy = default, + // ... + }; var progressHandler = _progressHandlerFactory.Create(); // The builder follows the Fluent convention, and more options will be added in the future. The only required component (besides the client name) @@ -54,7 +61,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to _consoleLogger.PrintCreatingTransfer(jobId, source, destination); var result = await transferClient - .UploadFileAsync(jobId, source, destination, progressHandler, token) + .UploadFileAsync(jobId, source, destination, uploadFileOptions, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(result); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadItems.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadItems.cs index 8dc8972..60f674d 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadItems.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadItems.cs @@ -3,6 +3,7 @@ using System.IO; using System.Threading; using System.Threading.Tasks; +using Relativity.Transfer.SDK.Interfaces.Options; using Relativity.Transfer.SDK.Interfaces.Paths; using Relativity.Transfer.SDK.Samples.Core.Attributes; using Relativity.Transfer.SDK.Samples.Core.Authentication; @@ -41,7 +42,13 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to var destination = string.IsNullOrWhiteSpace(configuration.UploadFile.Destination) ? _pathExtension.GetDefaultRemoteDirectoryPathForUpload(configuration.Common) : new DirectoryPath(configuration.UploadFile.Destination); - var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + var uploadListOfItemsOptions = new UploadListOfItemsOptions() + { + MaximumSpeed = default, + OverwritePolicy = default, + // ... + }; var progressHandler = _progressHandlerFactory.Create(); // The builder follows the Fluent convention, and more options will be added in the future. The only required component (besides the client name) @@ -58,7 +65,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to { var sources = GetTransferredEntities(configuration.UploadFile.Source); var result = await transferClient - .UploadItemsAsync(jobId, sources, destination, progressHandler, token) + .UploadItemsAsync(jobId, sources, destination, uploadListOfItemsOptions, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(result); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadToFileSharePathBasedOnWorkspaceId.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadToFileSharePathBasedOnWorkspaceId.cs index 90ff20d..b5c3bf4 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadToFileSharePathBasedOnWorkspaceId.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadToFileSharePathBasedOnWorkspaceId.cs @@ -7,6 +7,7 @@ using System.Threading; using System.Threading.Tasks; using Newtonsoft.Json; +using Relativity.Transfer.SDK.Interfaces.Options; using Relativity.Transfer.SDK.Interfaces.Paths; using Relativity.Transfer.SDK.Samples.Core.Attributes; using Relativity.Transfer.SDK.Samples.Core.Authentication; @@ -53,6 +54,12 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to var jobId = configuration.Common.JobId; var source = new DirectoryPath(configuration.UploadDirectoryByWorkspaceId.Source); var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + var uploadDirectoryOptions = new UploadDirectoryOptions() + { + MaximumSpeed = default, + OverwritePolicy = default, + // ... + }; var progressHandler = _progressHandlerFactory.Create(); // Get list of file shares by workspace ID. The association is based on Resource Pool assigned to the workspace. @@ -76,7 +83,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to _consoleLogger.PrintCreatingTransfer(jobId, source, destination); var result = await transferClient - .UploadDirectoryAsync(jobId, source, destination, progressHandler, token) + .UploadDirectoryAsync(jobId, source, destination, uploadDirectoryOptions, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(result); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/DownloadDirectory.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/DownloadDirectory.cs index 04308cf..6779037 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/DownloadDirectory.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/DownloadDirectory.cs @@ -2,6 +2,7 @@ using System.Threading; using System.Threading.Tasks; using Relativity.Transfer.SDK.Interfaces.Authentication; +using Relativity.Transfer.SDK.Interfaces.Options; using Relativity.Transfer.SDK.Interfaces.Paths; using Relativity.Transfer.SDK.Samples.Core.Attributes; using Relativity.Transfer.SDK.Samples.Core.Authentication; @@ -42,8 +43,14 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to ? _pathExtension.GetDefaultRemoteDirectoryPathForDownload(configuration.Common) : new DirectoryPath(configuration.DownloadDirectory.Source); var destination = _pathExtension.EnsureLocalDirectory(configuration.DownloadDirectory.Destination); - var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); - var progressHandler = _progressHandlerFactory.Create(); + var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + var downloadDirectoryOptions = new DownloadDirectoryOptions() + { + MaximumSpeed = default, + OverwritePolicy = default, + // ... + }; + var progressHandler = _progressHandlerFactory.Create(); await RegisterDownloadJobAsync(authenticationProvider, jobId, source).ConfigureAwait(false); @@ -59,7 +66,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to _consoleLogger.PrintCreatingTransfer(jobId, source, destination); var result = await transferClient - .DownloadDirectoryAsync(jobId, destination, progressHandler, token) + .DownloadDirectoryAsync(jobId, destination, downloadDirectoryOptions, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(result); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/DownloadDirectoryBasedOnExistingJob.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/DownloadDirectoryBasedOnExistingJob.cs index 7532bc6..77d4a73 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/DownloadDirectoryBasedOnExistingJob.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/DownloadDirectoryBasedOnExistingJob.cs @@ -2,6 +2,7 @@ using System.Threading; using System.Threading.Tasks; using Relativity.Transfer.SDK.Interfaces.Authentication; +using Relativity.Transfer.SDK.Interfaces.Options; using Relativity.Transfer.SDK.Interfaces.Paths; using Relativity.Transfer.SDK.Samples.Core.Attributes; using Relativity.Transfer.SDK.Samples.Core.Authentication; @@ -43,8 +44,14 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to string.IsNullOrWhiteSpace(configuration.DownloadDirectoryBasedOnExistingJob.FirstDestination) ? _pathExtension.GetDefaultRemoteDirectoryPathForUpload(configuration.Common) : new DirectoryPath(configuration.DownloadDirectoryBasedOnExistingJob.FirstDestination); - var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); - var progressHandler = _progressHandlerFactory.Create(); + var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + var uploadDirectoryOptions = new UploadDirectoryOptions() + { + MaximumSpeed = default, + OverwritePolicy = default, + // ... + }; + var progressHandler = _progressHandlerFactory.Create(); // The builder follows the Fluent convention, and more options will be added in the future. The only required component (besides the client name) // is the authentication provider - a provided one that utilizes an OAuth-based approach has been provided, but the custom implementation can be created. @@ -58,7 +65,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to _consoleLogger.PrintCreatingTransfer(uploadJobId, uploadSource, uploadDestination); var uploadResult = await transferFullPathClient - .UploadDirectoryAsync(uploadJobId, uploadSource, uploadDestination, progressHandler, token) + .UploadDirectoryAsync(uploadJobId, uploadSource, uploadDestination, uploadDirectoryOptions, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(uploadResult, "Upload transfer has finished:", false); @@ -78,10 +85,17 @@ await RegisterDownloadJobFromExistingJobAsync(authenticationProvider, downloadJo .WithStagingExplorerContext() .Build(); - _consoleLogger.PrintCreatingTransfer(downloadJobId, uploadSource, downloadDestination); - - var downloadResult = await transferJobClient - .DownloadDirectoryAsync(downloadJobId, downloadDestination, progressHandler, token) + _consoleLogger.PrintCreatingTransfer(downloadJobId, uploadSource, downloadDestination); + + var downloadDirectoryOptions = new DownloadDirectoryOptions() + { + MaximumSpeed = default, + OverwritePolicy = default, + // ... + }; + + var downloadResult = await transferJobClient + .DownloadDirectoryAsync(downloadJobId, downloadDestination, downloadDirectoryOptions, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(downloadResult, "Download transfer has finished:"); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadDirectory.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadDirectory.cs index 423d977..0cea45d 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadDirectory.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadDirectory.cs @@ -2,6 +2,7 @@ using System.Threading; using System.Threading.Tasks; using Relativity.Transfer.SDK.Interfaces.Authentication; +using Relativity.Transfer.SDK.Interfaces.Options; using Relativity.Transfer.SDK.Interfaces.Paths; using Relativity.Transfer.SDK.Samples.Core.Attributes; using Relativity.Transfer.SDK.Samples.Core.Authentication; @@ -42,8 +43,14 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to var destination = string.IsNullOrWhiteSpace(configuration.UploadDirectory.Destination) ? _pathExtension.GetDefaultRemoteDirectoryPathForUpload(configuration.Common) : new DirectoryPath(configuration.UploadDirectory.Destination); - var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); - var progressHandler = _progressHandlerFactory.Create(); + var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + var uploadDirectoryOptions = new UploadDirectoryOptions() + { + MaximumSpeed = default, + OverwritePolicy = default, + // ... + }; + var progressHandler = _progressHandlerFactory.Create(); await RegisterUploadDirectoryJobAsync(authenticationProvider, jobId, destination).ConfigureAwait(false); @@ -59,7 +66,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to _consoleLogger.PrintCreatingTransfer(jobId, source, destination); var result = await transferClient - .UploadDirectoryAsync(jobId, source, progressHandler, token) + .UploadDirectoryAsync(jobId, source, uploadDirectoryOptions, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(result); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadDirectoryBasedOnExistingJob.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadDirectoryBasedOnExistingJob.cs index 8743a24..0a84700 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadDirectoryBasedOnExistingJob.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadDirectoryBasedOnExistingJob.cs @@ -1,6 +1,7 @@ using System; using System.Threading; using System.Threading.Tasks; +using Relativity.Transfer.SDK.Interfaces.Options; using Relativity.Transfer.SDK.Interfaces.Paths; using Relativity.Transfer.SDK.Samples.Core.Attributes; using Relativity.Transfer.SDK.Samples.Core.Authentication; @@ -46,8 +47,14 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to // To enhance the visual representation of the newly transferred data alongside the previously transferred data by the preceding job, it is advisable to utilize a unique source data set. var secondSource = new DirectoryPath(configuration.UploadDirectoryBasedOnExistingJob.SecondSource); var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); - var jobBuilder = new TransferJobBuilder(authenticationProvider); - var progressHandler = _progressHandlerFactory.Create(); + var jobBuilder = new TransferJobBuilder(authenticationProvider); + var uploadDirectoryOptions = new UploadDirectoryOptions() + { + MaximumSpeed = default, + OverwritePolicy = default, + // ... + }; + var progressHandler = _progressHandlerFactory.Create(); await RegisterUploadDirectoryJobAsync(jobBuilder, firstJobId, destination).ConfigureAwait(false); @@ -63,7 +70,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to _consoleLogger.PrintCreatingTransfer(firstJobId, firstSource, destination); var firstResult = await transferClient - .UploadDirectoryAsync(firstJobId, firstSource, progressHandler, token) + .UploadDirectoryAsync(firstJobId, firstSource, uploadDirectoryOptions, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(firstResult, "First transfer has finished:", false); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadItems.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadItems.cs index df2f5e3..8652df3 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadItems.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadItems.cs @@ -4,6 +4,7 @@ using System.Threading; using System.Threading.Tasks; using Relativity.Transfer.SDK.Interfaces.Authentication; +using Relativity.Transfer.SDK.Interfaces.Options; using Relativity.Transfer.SDK.Interfaces.Paths; using Relativity.Transfer.SDK.Samples.Core.Attributes; using Relativity.Transfer.SDK.Samples.Core.Authentication; @@ -42,7 +43,13 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to var destination = string.IsNullOrWhiteSpace(configuration.UploadFile.Destination) ? _pathExtension.GetDefaultRemoteDirectoryPathForUpload(configuration.Common) : new DirectoryPath(configuration.UploadFile.Destination); - var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + var uploadListOfItemsOptions = new UploadListOfItemsOptions() + { + MaximumSpeed = default, + OverwritePolicy = default, + // ... + }; var progressHandler = _progressHandlerFactory.Create(); await RegisterUploadDirectoryJobAsync(authenticationProvider, jobId, destination).ConfigureAwait(false); @@ -62,7 +69,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to { var sources = GetTransferredEntities(configuration.UploadFile.Source); var result = await transferClient - .UploadItemsAsync(jobId, sources, progressHandler, token) + .UploadItemsAsync(jobId, sources, uploadListOfItemsOptions, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(result); From 8fcebbd0e9aa33a61287338c7d7bb1c23191cc77 Mon Sep 17 00:00:00 2001 From: Robert Gabor Date: Tue, 12 Nov 2024 10:29:39 +0100 Subject: [PATCH 2/3] chore: Added comments to transfer options. --- .../FullPathWorkflow/DownloadDirectory.cs | 5 ++++- .../FullPathWorkflow/DownloadFile.cs | 5 ++++- .../SettingUpProgressHandlerAndPrintingSummary.cs | 7 +++++-- .../FullPathWorkflow/UploadDirectory.cs | 3 +++ .../UploadDirectoryWithCustomizedRetryPolicy.cs | 4 +++- .../UploadDirectoryWithExclusionPolicy.cs | 4 +++- .../FullPathWorkflow/UploadFile.cs | 5 ++++- .../FullPathWorkflow/UploadItems.cs | 5 ++++- .../UploadToFileSharePathBasedOnWorkspaceId.cs | 5 ++++- .../JobBasedWorkflow/DownloadDirectory.cs | 7 +++++-- .../DownloadDirectoryBasedOnExistingJob.cs | 8 +++++--- .../JobBasedWorkflow/UploadDirectory.cs | 7 +++++-- .../JobBasedWorkflow/UploadDirectoryBasedOnExistingJob.cs | 7 +++++-- .../JobBasedWorkflow/UploadItems.cs | 5 ++++- 14 files changed, 58 insertions(+), 19 deletions(-) diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/DownloadDirectory.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/DownloadDirectory.cs index c19d01b..42f3c80 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/DownloadDirectory.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/DownloadDirectory.cs @@ -42,6 +42,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to : new DirectoryPath(configuration.DownloadDirectory.Source); var destination = _pathExtension.EnsureLocalDirectory(configuration.DownloadDirectory.Destination); var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + // This is transfer options object which is not necessary if you do not need change default parameters. var downloadDirectoryOptions = new DownloadDirectoryOptions() { MaximumSpeed = default, @@ -61,7 +62,9 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to _consoleLogger.PrintCreatingTransfer(jobId, source, destination); var result = await transferClient - .DownloadDirectoryAsync(jobId, source, destination, downloadDirectoryOptions, progressHandler, token) + .DownloadDirectoryAsync(jobId, source, destination, downloadDirectoryOptions, progressHandler, token) + // If you do not need pass transfer options you can invoke this method like this: + //.DownloadDirectoryAsync(jobId, source, destination, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(result); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/DownloadFile.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/DownloadFile.cs index a3a22ce..e7eabf7 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/DownloadFile.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/DownloadFile.cs @@ -40,6 +40,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to var source = new FilePath(configuration.DownloadFile.Source); var destination = _pathExtension.EnsureLocalDirectory(configuration.DownloadFile.Destination); var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + // This is transfer options object which is not necessary if you do not need change default parameters. var downloadFileOptions = new DownloadFileOptions() { MaximumSpeed = default, @@ -59,7 +60,9 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to _consoleLogger.PrintCreatingTransfer(jobId, source, destination); var result = await transferClient - .DownloadFileAsync(jobId, source, destination, downloadFileOptions, progressHandler, token) + .DownloadFileAsync(jobId, source, destination, downloadFileOptions, progressHandler, token) + // If you do not need pass transfer options you can invoke this method like this: + //.DownloadFileAsync(jobId, source, destination, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(result); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/SettingUpProgressHandlerAndPrintingSummary.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/SettingUpProgressHandlerAndPrintingSummary.cs index b1e1267..4bba66e 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/SettingUpProgressHandlerAndPrintingSummary.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/SettingUpProgressHandlerAndPrintingSummary.cs @@ -49,6 +49,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to var destination = string.IsNullOrWhiteSpace(configuration.UploadDirectory.Destination) ? _pathExtension.GetDefaultRemoteDirectoryPathForUpload(configuration.Common) : new DirectoryPath(configuration.UploadDirectory.Destination); + // This is transfer options object which is not necessary if you do not need change default parameters. var uploadDirectoryOptions = new UploadDirectoryOptions() { MaximumSpeed = default, @@ -67,8 +68,10 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to _consoleLogger.PrintCreatingTransfer(jobId, source, destination, additionalLine); - var result = await transferClient - .UploadDirectoryAsync(jobId, source, destination, uploadDirectoryOptions, GetProgressHandler(), default) + var result = await transferClient + .UploadDirectoryAsync(jobId, source, destination, uploadDirectoryOptions, GetProgressHandler(), default) + // If you do not need pass transfer options you can invoke this method like this: + //.UploadDirectoryAsync(jobId, source, destination, GetProgressHandler(), default) .ConfigureAwait(false); PrintTransferSummary(result); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadDirectory.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadDirectory.cs index e756caf..1154ba6 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadDirectory.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadDirectory.cs @@ -42,6 +42,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to ? _pathExtension.GetDefaultRemoteDirectoryPathForUpload(configuration.Common) : new DirectoryPath(configuration.UploadDirectory.Destination); var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + // This is transfer options object which is not necessary if you do not need change default parameters. var uploadDirectoryOptions = new UploadDirectoryOptions() { MaximumSpeed = default, @@ -62,6 +63,8 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to var result = await transferClient .UploadDirectoryAsync(jobId, source, destination, uploadDirectoryOptions, progressHandler, token) + // If you do not need pass transfer options you can invoke this method like this: + //.UploadDirectoryAsync(jobId, source, destination, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(result); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadDirectoryWithCustomizedRetryPolicy.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadDirectoryWithCustomizedRetryPolicy.cs index 45e5eda..c97e4ef 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadDirectoryWithCustomizedRetryPolicy.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadDirectoryWithCustomizedRetryPolicy.cs @@ -64,7 +64,9 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to }; var result = await transferClient - .UploadDirectoryAsync(jobId, source, destination, exponentialRetryPolicyOptions, progressHandler, token) + .UploadDirectoryAsync(jobId, source, destination, exponentialRetryPolicyOptions, progressHandler, token) + // If you do not need pass transfer options you can invoke this method like this: + //.UploadDirectoryAsync(jobId, source, destination, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(result); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadDirectoryWithExclusionPolicy.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadDirectoryWithExclusionPolicy.cs index c41823e..97775cb 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadDirectoryWithExclusionPolicy.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadDirectoryWithExclusionPolicy.cs @@ -70,7 +70,9 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to _consoleLogger.PrintCreatingTransfer(jobId, source, destination); var result = await transferClient - .UploadDirectoryAsync(jobId, source, destination, fileExclusionPolicyOptions, progressHandler, token) + .UploadDirectoryAsync(jobId, source, destination, fileExclusionPolicyOptions, progressHandler, token) + // If you do not need pass transfer options you can invoke this method like this: + //.UploadDirectoryAsync(jobId, source, destination, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(result); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadFile.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadFile.cs index 4fe1d5e..25c9be1 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadFile.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadFile.cs @@ -42,6 +42,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to ? _pathExtension.GetDefaultRemoteDirectoryPathForUpload(configuration.Common) : new DirectoryPath(configuration.UploadFile.Destination); var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + // This is transfer options object which is not necessary if you do not need change default parameters. var uploadFileOptions = new UploadFileOptions() { MaximumSpeed = default, @@ -61,7 +62,9 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to _consoleLogger.PrintCreatingTransfer(jobId, source, destination); var result = await transferClient - .UploadFileAsync(jobId, source, destination, uploadFileOptions, progressHandler, token) + .UploadFileAsync(jobId, source, destination, uploadFileOptions, progressHandler, token) + // If you do not need pass transfer options you can invoke this method like this: + //.UploadDirectoryAsync(jobId, source, destination, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(result); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadItems.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadItems.cs index 60f674d..2e2941b 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadItems.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadItems.cs @@ -43,6 +43,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to ? _pathExtension.GetDefaultRemoteDirectoryPathForUpload(configuration.Common) : new DirectoryPath(configuration.UploadFile.Destination); var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + // This is transfer options object which is not necessary if you do not need change default parameters. var uploadListOfItemsOptions = new UploadListOfItemsOptions() { MaximumSpeed = default, @@ -65,7 +66,9 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to { var sources = GetTransferredEntities(configuration.UploadFile.Source); var result = await transferClient - .UploadItemsAsync(jobId, sources, destination, uploadListOfItemsOptions, progressHandler, token) + .UploadItemsAsync(jobId, sources, destination, uploadListOfItemsOptions, progressHandler, token) + // If you do not need pass transfer options you can invoke this method like this: + //.UploadItemsAsync(jobId, sources, destination, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(result); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadToFileSharePathBasedOnWorkspaceId.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadToFileSharePathBasedOnWorkspaceId.cs index b5c3bf4..29d5459 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadToFileSharePathBasedOnWorkspaceId.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadToFileSharePathBasedOnWorkspaceId.cs @@ -54,6 +54,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to var jobId = configuration.Common.JobId; var source = new DirectoryPath(configuration.UploadDirectoryByWorkspaceId.Source); var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + // This is transfer options object which is not necessary if you do not need change default parameters. var uploadDirectoryOptions = new UploadDirectoryOptions() { MaximumSpeed = default, @@ -83,7 +84,9 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to _consoleLogger.PrintCreatingTransfer(jobId, source, destination); var result = await transferClient - .UploadDirectoryAsync(jobId, source, destination, uploadDirectoryOptions, progressHandler, token) + .UploadDirectoryAsync(jobId, source, destination, uploadDirectoryOptions, progressHandler, token) + // If you do not need pass transfer options you can invoke this method like this: + //.UploadDirectoryAsync(jobId, source, destination, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(result); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/DownloadDirectory.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/DownloadDirectory.cs index 6779037..85bbf63 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/DownloadDirectory.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/DownloadDirectory.cs @@ -44,6 +44,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to : new DirectoryPath(configuration.DownloadDirectory.Source); var destination = _pathExtension.EnsureLocalDirectory(configuration.DownloadDirectory.Destination); var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + // This is transfer options object which is not necessary if you do not need change default parameters. var downloadDirectoryOptions = new DownloadDirectoryOptions() { MaximumSpeed = default, @@ -66,8 +67,10 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to _consoleLogger.PrintCreatingTransfer(jobId, source, destination); var result = await transferClient - .DownloadDirectoryAsync(jobId, destination, downloadDirectoryOptions, progressHandler, token) - .ConfigureAwait(false); + .DownloadDirectoryAsync(jobId, destination, downloadDirectoryOptions, progressHandler, token) + // If you do not need pass transfer options you can invoke this method like this: + //.DownloadDirectoryAsync(jobId, destination, progressHandler, token) + .ConfigureAwait(false); _consoleLogger.PrintTransferResult(result); } diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/DownloadDirectoryBasedOnExistingJob.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/DownloadDirectoryBasedOnExistingJob.cs index 77d4a73..9806b7f 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/DownloadDirectoryBasedOnExistingJob.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/DownloadDirectoryBasedOnExistingJob.cs @@ -86,7 +86,7 @@ await RegisterDownloadJobFromExistingJobAsync(authenticationProvider, downloadJo .Build(); _consoleLogger.PrintCreatingTransfer(downloadJobId, uploadSource, downloadDestination); - + // This is transfer options object which is not necessary if you do not need change default parameters. var downloadDirectoryOptions = new DownloadDirectoryOptions() { MaximumSpeed = default, @@ -95,8 +95,10 @@ await RegisterDownloadJobFromExistingJobAsync(authenticationProvider, downloadJo }; var downloadResult = await transferJobClient - .DownloadDirectoryAsync(downloadJobId, downloadDestination, downloadDirectoryOptions, progressHandler, token) - .ConfigureAwait(false); + .DownloadDirectoryAsync(downloadJobId, downloadDestination, downloadDirectoryOptions, progressHandler, token) + // If you do not need pass transfer options you can invoke this method like this: + //.DownloadDirectoryAsync(downloadJobId, downloadDestination, progressHandler, token) + .ConfigureAwait(false); _consoleLogger.PrintTransferResult(downloadResult, "Download transfer has finished:"); } diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadDirectory.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadDirectory.cs index 0cea45d..0d6d555 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadDirectory.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadDirectory.cs @@ -44,6 +44,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to ? _pathExtension.GetDefaultRemoteDirectoryPathForUpload(configuration.Common) : new DirectoryPath(configuration.UploadDirectory.Destination); var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + // This is transfer options object which is not necessary if you do not need change default parameters. var uploadDirectoryOptions = new UploadDirectoryOptions() { MaximumSpeed = default, @@ -66,8 +67,10 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to _consoleLogger.PrintCreatingTransfer(jobId, source, destination); var result = await transferClient - .UploadDirectoryAsync(jobId, source, uploadDirectoryOptions, progressHandler, token) - .ConfigureAwait(false); + .UploadDirectoryAsync(jobId, source, uploadDirectoryOptions, progressHandler, token) + // If you do not need pass transfer options you can invoke this method like this: + //.UploadDirectoryAsync(jobId, source, progressHandler, token) + .ConfigureAwait(false); _consoleLogger.PrintTransferResult(result); } diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadDirectoryBasedOnExistingJob.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadDirectoryBasedOnExistingJob.cs index 0a84700..8f1758a 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadDirectoryBasedOnExistingJob.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadDirectoryBasedOnExistingJob.cs @@ -48,6 +48,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to var secondSource = new DirectoryPath(configuration.UploadDirectoryBasedOnExistingJob.SecondSource); var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); var jobBuilder = new TransferJobBuilder(authenticationProvider); + // This is transfer options object which is not necessary if you do not need change default parameters. var uploadDirectoryOptions = new UploadDirectoryOptions() { MaximumSpeed = default, @@ -70,8 +71,10 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to _consoleLogger.PrintCreatingTransfer(firstJobId, firstSource, destination); var firstResult = await transferClient - .UploadDirectoryAsync(firstJobId, firstSource, uploadDirectoryOptions, progressHandler, token) - .ConfigureAwait(false); + .UploadDirectoryAsync(firstJobId, firstSource, uploadDirectoryOptions, progressHandler, token) + // If you do not need pass transfer options you can invoke this method like this: + //.UploadDirectoryAsync(firstJobId, firstSource, progressHandler, token) + .ConfigureAwait(false); _consoleLogger.PrintTransferResult(firstResult, "First transfer has finished:", false); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadItems.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadItems.cs index 8652df3..6bf46f4 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadItems.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadItems.cs @@ -44,6 +44,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to ? _pathExtension.GetDefaultRemoteDirectoryPathForUpload(configuration.Common) : new DirectoryPath(configuration.UploadFile.Destination); var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + // This is transfer options object which is not necessary if you do not need change default parameters. var uploadListOfItemsOptions = new UploadListOfItemsOptions() { MaximumSpeed = default, @@ -69,7 +70,9 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to { var sources = GetTransferredEntities(configuration.UploadFile.Source); var result = await transferClient - .UploadItemsAsync(jobId, sources, uploadListOfItemsOptions, progressHandler, token) + .UploadItemsAsync(jobId, sources, uploadListOfItemsOptions, progressHandler, token) + // If you do not need pass transfer options you can invoke this method like this: + //.UploadItemsAsync(jobId, sources, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(result); From c618281107500ba6bbfba629874b65214ecfd1c7 Mon Sep 17 00:00:00 2001 From: Robert Gabor Date: Tue, 12 Nov 2024 10:41:11 +0100 Subject: [PATCH 3/3] chore: Added more transfer options comments. --- .../FullPathWorkflow/UploadFile.cs | 2 +- .../DownloadDirectoryBasedOnExistingJob.cs | 7 ++++-- .../UploadDirectoryBasedOnExistingJob.cs | 22 ++++++++++++++----- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadFile.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadFile.cs index 25c9be1..8312350 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadFile.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/FullPathWorkflow/UploadFile.cs @@ -64,7 +64,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to var result = await transferClient .UploadFileAsync(jobId, source, destination, uploadFileOptions, progressHandler, token) // If you do not need pass transfer options you can invoke this method like this: - //.UploadDirectoryAsync(jobId, source, destination, progressHandler, token) + //.UploadFileAsync(jobId, source, destination, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(result); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/DownloadDirectoryBasedOnExistingJob.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/DownloadDirectoryBasedOnExistingJob.cs index 9806b7f..3c391ca 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/DownloadDirectoryBasedOnExistingJob.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/DownloadDirectoryBasedOnExistingJob.cs @@ -45,6 +45,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to ? _pathExtension.GetDefaultRemoteDirectoryPathForUpload(configuration.Common) : new DirectoryPath(configuration.DownloadDirectoryBasedOnExistingJob.FirstDestination); var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); + // This is transfer options object which is not necessary if you do not need change default parameters. var uploadDirectoryOptions = new UploadDirectoryOptions() { MaximumSpeed = default, @@ -65,8 +66,10 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to _consoleLogger.PrintCreatingTransfer(uploadJobId, uploadSource, uploadDestination); var uploadResult = await transferFullPathClient - .UploadDirectoryAsync(uploadJobId, uploadSource, uploadDestination, uploadDirectoryOptions, progressHandler, token) - .ConfigureAwait(false); + .UploadDirectoryAsync(uploadJobId, uploadSource, uploadDestination, uploadDirectoryOptions, progressHandler, token) + // If you do not need pass transfer options you can invoke this method like this: + //.UploadDirectoryAsync(uploadJobId, uploadSource, uploadDestination, progressHandler, token) + .ConfigureAwait(false); _consoleLogger.PrintTransferResult(uploadResult, "Upload transfer has finished:", false); diff --git a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadDirectoryBasedOnExistingJob.cs b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadDirectoryBasedOnExistingJob.cs index 8f1758a..fde5d64 100644 --- a/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadDirectoryBasedOnExistingJob.cs +++ b/Source/Relativity.Transfer.SDK.Samples.Repository/JobBasedWorkflow/UploadDirectoryBasedOnExistingJob.cs @@ -49,7 +49,7 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to var authenticationProvider = _relativityAuthenticationProviderFactory.Create(configuration.Common); var jobBuilder = new TransferJobBuilder(authenticationProvider); // This is transfer options object which is not necessary if you do not need change default parameters. - var uploadDirectoryOptions = new UploadDirectoryOptions() + var firstUploadDirectoryOptions = new UploadDirectoryOptions() { MaximumSpeed = default, OverwritePolicy = default, @@ -71,18 +71,28 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to _consoleLogger.PrintCreatingTransfer(firstJobId, firstSource, destination); var firstResult = await transferClient - .UploadDirectoryAsync(firstJobId, firstSource, uploadDirectoryOptions, progressHandler, token) + .UploadDirectoryAsync(firstJobId, firstSource, firstUploadDirectoryOptions, progressHandler, token) // If you do not need pass transfer options you can invoke this method like this: //.UploadDirectoryAsync(firstJobId, firstSource, progressHandler, token) .ConfigureAwait(false); _consoleLogger.PrintTransferResult(firstResult, "First transfer has finished:", false); - await RegisterUploadJobFromExistingJobAsync(jobBuilder, secondJobId, firstJobId).ConfigureAwait(false); - + await RegisterUploadJobFromExistingJobAsync(jobBuilder, secondJobId, firstJobId).ConfigureAwait(false); + + // This is transfer options object which is not necessary if you do not need change default parameters. + var secondUploadDirectoryOptions = new UploadDirectoryOptions() + { + MaximumSpeed = default, + OverwritePolicy = default, + // ... + }; + var secondResult = await transferClient - .UploadDirectoryAsync(secondJobId, secondSource, progressHandler, token) - .ConfigureAwait(false); + .UploadDirectoryAsync(secondJobId, secondSource, secondUploadDirectoryOptions, progressHandler, token) + // If you do not need pass transfer options you can invoke this method like this: + //.UploadDirectoryAsync(secondJobId, secondSource, progressHandler, token) + .ConfigureAwait(false); _consoleLogger.PrintTransferResult(secondResult, "Second transfer has finished:"); }