Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added transfer options to all transfer types. #25

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net462;net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;net462</TargetFrameworks>
<LangVersion>10.0</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ByteSize" Version="2.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Relativity.Transfer.SDK" Version="2.1.2" />
<PackageReference Include="Spectre.Console" Version="0.48.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
<PackageReference Include="Relativity.Transfer.SDK" Version="2.7.0" />
<PackageReference Include="Spectre.Console" Version="0.49.1" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
<ItemGroup>
<PackageReference Include="ByteSize" Version="2.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Relativity.Transfer.SDK" Version="2.1.2" />
<PackageReference Include="Spectre.Console" Version="0.48.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.0" />
<PackageReference Include="Relativity.Transfer.SDK" Version="2.7.0" />
<PackageReference Include="Spectre.Console" Version="0.49.1" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -41,6 +42,13 @@ 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,
GrzegorzSidwa marked this conversation as resolved.
Show resolved Hide resolved
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)
Expand All @@ -54,7 +62,9 @@ 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)
// 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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -38,7 +39,14 @@ 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);
// This is transfer options object which is not necessary if you do not need change default parameters.
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)
Expand All @@ -52,7 +60,9 @@ 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)
// 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -47,7 +48,14 @@ 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);
// This is transfer options object which is not necessary if you do not need change default parameters.
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)
Expand All @@ -60,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, 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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -40,7 +41,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 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,
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)
Expand All @@ -54,7 +62,9 @@ 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)
// 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -40,7 +41,14 @@ 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);
// This is transfer options object which is not necessary if you do not need change default parameters.
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)
Expand All @@ -54,7 +62,9 @@ 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)
// If you do not need pass transfer options you can invoke this method like this:
//.UploadFileAsync(jobId, source, destination, progressHandler, token)
.ConfigureAwait(false);

_consoleLogger.PrintTransferResult(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -41,7 +42,14 @@ 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);
// This is transfer options object which is not necessary if you do not need change default parameters.
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)
Expand All @@ -58,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, 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -53,6 +54,13 @@ 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,
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.
Expand All @@ -76,7 +84,9 @@ 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)
// 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -42,8 +43,15 @@ 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);
// This is transfer options object which is not necessary if you do not need change default parameters.
var downloadDirectoryOptions = new DownloadDirectoryOptions()
{
MaximumSpeed = default,
OverwritePolicy = default,
// ...
};
var progressHandler = _progressHandlerFactory.Create();

await RegisterDownloadJobAsync(authenticationProvider, jobId, source).ConfigureAwait(false);

Expand All @@ -59,8 +67,10 @@ public async Task ExecuteAsync(Configuration configuration, CancellationToken to
_consoleLogger.PrintCreatingTransfer(jobId, source, destination);

var result = await transferClient
.DownloadDirectoryAsync(jobId, destination, 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);
}
Expand Down
Loading