diff --git a/oss/source/custom-code/OssClient.cs b/oss/source/custom-code/OssClient.cs index 9ef8627..e44700f 100644 --- a/oss/source/custom-code/OssClient.cs +++ b/oss/source/custom-code/OssClient.cs @@ -5,7 +5,6 @@ using Autodesk.Oss.Model; using Autodesk.Oss.Client; using System.Threading; -using System.Threading.Tasks; namespace Autodesk.Oss { @@ -30,7 +29,7 @@ public async System.Threading.Tasks.Task Upload(string bucketKey, var apiResponse = new ApiResponse(response, await LocalMarshalling.DeserializeAsync(response.Content)); return apiResponse.Content; } - public async Task Download(string bucketKey, string objectKey,string filePath,string accessToken,CancellationToken cancellationToken,string projectScope = "",string requestIdPrefix = "",IProgress progress = null) + public async System.Threading.Tasks.Task Download(string bucketKey, string objectKey,string filePath,string accessToken,CancellationToken cancellationToken,string projectScope = "",string requestIdPrefix = "",IProgress progress = null) { await this.oSSFileTransfer.Download(bucketKey,objectKey,filePath,accessToken,cancellationToken,projectScope,requestIdPrefix,progress); } diff --git a/samples/oss.cs b/samples/oss.cs index f529d73..bd8caf7 100644 --- a/samples/oss.cs +++ b/samples/oss.cs @@ -10,6 +10,7 @@ class OSS string bucketKey = ""; string objectName = ""; string sourceToUpload = ""; + string filePath =""; OssClient ossClient = null!; @@ -44,6 +45,11 @@ public async Task Upload() string objectKey = objectDetails.ObjectKey; } + public async Task Download() + { + //The below helper method takes care of the complete Download process, i.e. + await ossClient.Download(bucketKey, objectName, filePath, accessToken: token, CancellationToken.None); + } public async void Main() { @@ -53,6 +59,7 @@ public async void Main() // Call respective methods await GetBucketDetailsAsync(); await Upload(); + await Download(); } } } \ No newline at end of file