diff --git a/oss/source/Http/BucketsApi.gen.cs b/oss/source/Http/BucketsApi.gen.cs index 9257725..b6d6be8 100644 --- a/oss/source/Http/BucketsApi.gen.cs +++ b/oss/source/Http/BucketsApi.gen.cs @@ -47,7 +47,7 @@ public interface IBucketsApi /// ///Buckets are virtual container within the Object Storage Service (OSS), which you can use to store and manage objects (files) in the cloud. The application creating the bucket is the owner of the bucket. /// - ///**Note:** Do not use this operation to create buckets for BIM360 Document Management. Use [POST projects/{project_id}/storage](/en/docs/data/v2/reference/http/projects-project_id-storage-POST>_ instead. For details, see `Upload Files to BIM 360 Document Management ) instead. For details, see [Upload Files to BIM 360 Document Management](/en/docs/bim360/v1/tutorials/document-management/upload-document). /// /// Thrown when fails to make API call /// @@ -62,7 +62,7 @@ public interface IBucketsApi /// /// Task of ApiResponse<Bucket> - System.Threading.Tasks.Task> CreateBucketAsync(CreateBucketsPayload policyKey, Region xAdsRegion , string accessToken = null, bool throwOnError = true); + System.Threading.Tasks.Task> CreateBucketAsync(CreateBucketsPayload policyKey, Region xAdsRegion, string accessToken = null, bool throwOnError = true); /// /// Delete Bucket /// diff --git a/oss/source/Model/Access.gen.cs b/oss/source/Model/Access.gen.cs index e2b2e26..a0adec7 100644 --- a/oss/source/Model/Access.gen.cs +++ b/oss/source/Model/Access.gen.cs @@ -33,9 +33,9 @@ namespace Autodesk.Oss.Model { /// - /// Access for signed resource Acceptable values: read, write, readwrite Default value: read + /// Access for signed resource Possible values: read, write, readwrite Default value: read /// - ///Access for signed resource Acceptable values: read, write, readwrite Default value: read + ///Access for signed resource Possible values: read, write, readwrite Default value: read [JsonConverter(typeof(StringEnumConverter))] diff --git a/oss/source/Model/Batchsigneds3downloadResponse.gen.cs b/oss/source/Model/Batchsigneds3downloadResponse.gen.cs index a89b0d1..c655fb9 100644 --- a/oss/source/Model/Batchsigneds3downloadResponse.gen.cs +++ b/oss/source/Model/Batchsigneds3downloadResponse.gen.cs @@ -46,8 +46,11 @@ public Batchsigneds3downloadResponse() } /// - ///Gets or Sets Results + ///A map of the returned results; each key in the map corresponds to an object key in the batch, and the value includes the results for that object. /// + /// + ///A map of the returned results; each key in the map corresponds to an object key in the batch, and the value includes the results for that object. + /// [DataMember(Name="results", EmitDefaultValue=false)] public Dictionary Results { get; set; } diff --git a/oss/source/Model/Batchsigneds3uploadResponse.gen.cs b/oss/source/Model/Batchsigneds3uploadResponse.gen.cs index 8e15170..60be5ee 100644 --- a/oss/source/Model/Batchsigneds3uploadResponse.gen.cs +++ b/oss/source/Model/Batchsigneds3uploadResponse.gen.cs @@ -46,8 +46,11 @@ public Batchsigneds3uploadResponse() } /// - ///Gets or Sets Results + ///A map of the returned results; each key in the map corresponds to an object key in the batch, and the value includes the results for that object. /// + /// + ///A map of the returned results; each key in the map corresponds to an object key in the batch, and the value includes the results for that object. + /// [DataMember(Name="results", EmitDefaultValue=false)] public Dictionary Results { get; set; } diff --git a/oss/source/Model/DownloadResults.gen.cs b/oss/source/Model/DownloadResults.gen.cs index 8781bb7..5a3a73d 100644 --- a/oss/source/Model/DownloadResults.gen.cs +++ b/oss/source/Model/DownloadResults.gen.cs @@ -33,7 +33,7 @@ namespace Autodesk.Oss.Model { /// - /// An object that represents the response to a Batch Generate Signed S3 Download URLs operation. **Note**: objectKeyN is a placeholder for the first object key for which the client requested a download signed URL. The attributes within contain the success data / error information for the request for that object. `results` will contain one such attribute for each requested object in the batch. + /// An object that represents the response to a Batch Generate Signed S3 Download URLs operation. **Note**: ``objectKeyN`` is a placeholder for the first object key for which the client requested a download signed URL. The attributes within contain the success data / error information for the request for that object. `results` will contain one such attribute for each requested object in the batch. /// [DataContract] public partial class DownloadResults diff --git a/oss/source/Model/Region.gen.cs b/oss/source/Model/Region.gen.cs index 38f0264..1c61daf 100644 --- a/oss/source/Model/Region.gen.cs +++ b/oss/source/Model/Region.gen.cs @@ -33,7 +33,7 @@ namespace Autodesk.Oss.Model { /// - /// Specifies where the bucket containing the object stored. Possible values are: + /// Specifies where the bucket containing the object is stored. Possible values are: /// /// - `US` - (Default) Data center for the US region. /// - `EMEA` - Data center for the European Union, Middle East, and Africa. @@ -41,7 +41,7 @@ namespace Autodesk.Oss.Model /// /// **Note:** Beta features are subject to change. Please do not use in production environments. /// - ///Specifies where the bucket containing the object stored. Possible values are: + ///Specifies where the bucket containing the object is stored. Possible values are: /// /// - `US` - (Default) Data center for the US region. /// - `EMEA` - Data center for the European Union, Middle East, and Africa. diff --git a/oss/source/Model/Result.gen.cs b/oss/source/Model/Result.gen.cs index ea917f8..dcb3369 100644 --- a/oss/source/Model/Result.gen.cs +++ b/oss/source/Model/Result.gen.cs @@ -46,8 +46,11 @@ public Result() } /// - ///Gets or Sets _Result + ///A human friendly description of the state of processing. /// + /// + ///A human friendly description of the state of processing. + /// [DataMember(Name="result", EmitDefaultValue=false)] public string _Result { get; set; } diff --git a/oss/source/custom-code/IOSSFileTransfer.cs b/oss/source/custom-code/IOSSFileTransfer.cs index 973981d..e79212e 100644 --- a/oss/source/custom-code/IOSSFileTransfer.cs +++ b/oss/source/custom-code/IOSSFileTransfer.cs @@ -23,6 +23,7 @@ using System.Net.Http; using System.Threading.Tasks; using System.Threading; +using System.IO; namespace Autodesk.Oss { public interface IOSSFileTransfer @@ -31,7 +32,7 @@ public interface IOSSFileTransfer Task Upload( string bucketKey, string objectKey, - string sourceToUpload, + Stream sourceToUpload, string accessToken, CancellationToken cancellationToken, string projectScope = "", diff --git a/oss/source/custom-code/OSSFileTransfer.cs b/oss/source/custom-code/OSSFileTransfer.cs index 3210816..5c661e5 100644 --- a/oss/source/custom-code/OSSFileTransfer.cs +++ b/oss/source/custom-code/OSSFileTransfer.cs @@ -92,19 +92,17 @@ public OSSFileTransfer(IFileTransferConfigurations configuration, _authentication = authentication; } - private async Task IsFileSizeAllowed(string filePath) + private async Task IsFileSizeAllowed(Stream filePath) { return await Task.Run(() => { - using (FileStream fileStream = File.OpenRead(filePath)) - { - long fileSize = fileStream.Length; + + long fileSize = filePath.Length; double numberOfChunks = CalculateNumberOfChunks((ulong)fileSize); if (numberOfChunks > this._maxChunkCountAllowed) { return false; } - } return true; }); } @@ -112,7 +110,7 @@ private async Task IsFileSizeAllowed(string filePath) public async Task Upload( string bucketKey, string objectKey, - string sourceToUpload, + Stream sourceToUpload, string accessToken, CancellationToken cancellationToken, string projectScope = "", @@ -128,10 +126,7 @@ public async Task Upload( ValidateProjectScopeName(requestId, projectScope); progress?.Report(1); - - using (FileStream fileStream = File.OpenRead(sourceToUpload)) - { - ulong numberOfChunks = (ulong)CalculateNumberOfChunks((ulong)fileStream.Length); + ulong numberOfChunks = (ulong)CalculateNumberOfChunks((ulong)sourceToUpload.Length); ulong chunksUploaded = 0; long start = 0; @@ -140,7 +135,7 @@ public async Task Upload( _logger.LogInformation("{requestId} Total chunk to be uploaded: {numberOfChunks}", requestId, numberOfChunks); - using (BinaryReader reader = new BinaryReader(fileStream)) + using (BinaryReader reader = new BinaryReader(sourceToUpload)) { while (chunksUploaded < numberOfChunks) { @@ -148,7 +143,7 @@ public async Task Upload( int attempts = 0; - long end = Math.Min((long)((chunksUploaded + 1) * Constants.ChunkSize), fileStream.Length); + long end = Math.Min((long)((chunksUploaded + 1) * Constants.ChunkSize), sourceToUpload.Length); byte[] fileBytes = readFileBytes(reader, start, end); var retryUrlExpiryCount = 0; @@ -237,7 +232,6 @@ public async Task Upload( progress?.Report(100); return completeResponse; - } } private byte[] readFileBytes(BinaryReader reader, long start, long end) @@ -460,7 +454,7 @@ private async Task> GetS3SignedDownloadUrl throw new OssApiException($"{requestId} Failed to get download urls after maximum retry."); } - private async Task ValidateFileSize(string requestId, string sourceToUpload) + private async Task ValidateFileSize(string requestId, Stream sourceToUpload) { var sizeAllowed = await IsFileSizeAllowed(sourceToUpload); if (!sizeAllowed) diff --git a/oss/source/custom-code/OssClient.cs b/oss/source/custom-code/OssClient.cs index 104a4d6..cbe1e82 100644 --- a/oss/source/custom-code/OssClient.cs +++ b/oss/source/custom-code/OssClient.cs @@ -5,6 +5,7 @@ using Autodesk.Oss.Model; using Autodesk.Oss.Client; using System.Threading; +using System.IO; namespace Autodesk.Oss { @@ -38,8 +39,8 @@ public OssClient(SDKManager.SDKManager sdkManager) ///The URL-encoded human friendly name of the object. /// /// - ///The Path of the file to be uploaded - /// + ///Stream of the of file to be uploded or + ///Path of the file to be uploaded /// /// /// (optional) @@ -55,12 +56,24 @@ public OssClient(SDKManager.SDKManager sdkManager) /// /// Task of <Upload> - public async System.Threading.Tasks.Task Upload(string bucketKey, string objectKey, string sourceToUpload, string accessToken, CancellationToken cancellationToken, string projectScope = "", string requestIdPrefix = "", IProgress progress = null) + public async System.Threading.Tasks.Task Upload(string bucketKey, string objectKey, Stream sourceToUpload, string accessToken, CancellationToken cancellationToken, string projectScope = "", string requestIdPrefix = "", IProgress progress = null) { var response = await this.oSSFileTransfer.Upload(bucketKey, objectKey, sourceToUpload, accessToken, cancellationToken, projectScope, requestIdPrefix, progress); var apiResponse = new ApiResponse(response, await LocalMarshalling.DeserializeAsync(response.Content)); return apiResponse.Content; } + public async System.Threading.Tasks.Task Upload(string bucketKey, string objectKey, string sourceToUpload, string accessToken, CancellationToken cancellationToken, string projectScope = "", string requestIdPrefix = "", IProgress progress = null) + { + + using (FileStream SourceStream = File.Open(sourceToUpload, FileMode.Open)) + { + var result = new byte[SourceStream.Length]; + await SourceStream.ReadAsync(result, 0, (int)SourceStream.Length); + var response = await this.oSSFileTransfer.Upload(bucketKey, objectKey, new MemoryStream(result), accessToken, cancellationToken, projectScope, requestIdPrefix, progress); + var apiResponse = new ApiResponse(response, await LocalMarshalling.DeserializeAsync(response.Content)); + return apiResponse.Content; + } + } /// /// Dwonload a File @@ -113,7 +126,7 @@ public async System.Threading.Tasks.Task Download(string bucketKey, string objec /// /// Task of <BatchcompleteuploadResponse> - public async System.Threading.Tasks.Task BatchCompleteUploadAsync(string bucketKey, BatchcompleteuploadObject requests = default(BatchcompleteuploadObject), string accessToken = null, bool throwOnError = true) + public async System.Threading.Tasks.Task BatchCompleteUploadAsync(string accessToken, string bucketKey, BatchcompleteuploadObject requests = default(BatchcompleteuploadObject), bool throwOnError = true) { var response = await this.objectsApi.BatchCompleteUploadAsync(bucketKey, requests, accessToken, throwOnError); return response.Content; @@ -147,7 +160,7 @@ public async System.Threading.Tasks.Task Download(string bucketKey, string objec /// /// Task of <Batchsigneds3downloadResponse> - public async System.Threading.Tasks.Task BatchSignedS3DownloadAsync(string bucketKey, Batchsigneds3downloadObject requests, bool? publicResourceFallback = default(bool?), int? minutesExpiration = default(int?), string accessToken = null, bool throwOnError = true) + public async System.Threading.Tasks.Task BatchSignedS3DownloadAsync(string accessToken, string bucketKey, Batchsigneds3downloadObject requests, bool? publicResourceFallback = default(bool?), int? minutesExpiration = default(int?), bool throwOnError = true) { var response = await this.objectsApi.BatchSignedS3DownloadAsync(bucketKey, requests, publicResourceFallback, minutesExpiration, accessToken, throwOnError); return response.Content; @@ -183,7 +196,7 @@ public async System.Threading.Tasks.Task Download(string bucketKey, string objec /// /// Task of <Batchsigneds3uploadResponse> - public async System.Threading.Tasks.Task BatchSignedS3UploadAsync(string bucketKey, bool? useAcceleration = default(bool?), int? minutesExpiration = default(int?), Batchsigneds3uploadObject requests = default(Batchsigneds3uploadObject), string accessToken = null, bool throwOnError = true) + public async System.Threading.Tasks.Task BatchSignedS3UploadAsync(string accessToken , string bucketKey, Batchsigneds3uploadObject requests , bool? useAcceleration = default(bool?), int? minutesExpiration = default(int?), bool throwOnError = true) { var response = await this.objectsApi.BatchSignedS3UploadAsync(bucketKey, useAcceleration, minutesExpiration, requests, accessToken, throwOnError); return response.Content; @@ -224,7 +237,7 @@ public async System.Threading.Tasks.Task Download(string bucketKey, string objec /// /// Task of HttpResponseMessage - public async System.Threading.Tasks.Task CompleteSignedS3UploadAsync(string bucketKey, string objectKey, string contentType, Completes3uploadBody body, string xAdsMetaContentType = default(string), string xAdsMetaContentDisposition = default(string), string xAdsMetaContentEncoding = default(string), string xAdsMetaCacheControl = default(string), string xAdsUserDefinedMetadata = default(string), string accessToken = null, bool throwOnError = true) + public async System.Threading.Tasks.Task CompleteSignedS3UploadAsync(string accessToken, string bucketKey, string objectKey, string contentType, Completes3uploadBody body, string xAdsMetaContentType = default(string), string xAdsMetaContentDisposition = default(string), string xAdsMetaContentEncoding = default(string), string xAdsMetaCacheControl = default(string), string xAdsUserDefinedMetadata = default(string), bool throwOnError = true) { var response = await this.objectsApi.CompleteSignedS3UploadAsync(bucketKey, objectKey, contentType, body, xAdsMetaContentType, xAdsMetaContentDisposition, xAdsMetaContentEncoding, xAdsMetaCacheControl, xAdsUserDefinedMetadata, accessToken, throwOnError); return response; @@ -257,7 +270,7 @@ public async System.Threading.Tasks.Task Download(string bucketKey, string objec /// /// Task of <ObjectDetails> - public async System.Threading.Tasks.Task CopyToAsync(string bucketKey, string objectKey, string newObjName, string xAdsAcmNamespace = default(string), string xAdsAcmCheckGroups = default(string), string xAdsAcmGroups = default(string), string accessToken = null, bool throwOnError = true) + public async System.Threading.Tasks.Task CopyToAsync(string accessToken, string bucketKey, string objectKey, string newObjName, string xAdsAcmNamespace = default(string), string xAdsAcmCheckGroups = default(string), string xAdsAcmGroups = default(string), bool throwOnError = true) { var response = await this.objectsApi.CopyToAsync(bucketKey, objectKey, newObjName, xAdsAcmNamespace, xAdsAcmCheckGroups, xAdsAcmGroups, accessToken, throwOnError); return response.Content; @@ -285,7 +298,7 @@ public async System.Threading.Tasks.Task Download(string bucketKey, string objec /// /// Task of <Bucket> - public async System.Threading.Tasks.Task CreateBucketAsync(Region xAdsRegion, CreateBucketsPayload policyKey, string accessToken = null, bool throwOnError = true) + public async System.Threading.Tasks.Task CreateBucketAsync(string accessToken, Region xAdsRegion, CreateBucketsPayload policyKey, bool throwOnError = true) { var response = await this.bucketsApi.CreateBucketAsync(policyKey, xAdsRegion, accessToken, throwOnError); return response.Content; @@ -320,7 +333,7 @@ public async System.Threading.Tasks.Task CreateBucketAsync(Region xAdsRe /// /// Task of <CreateObjectSigned> - public async System.Threading.Tasks.Task CreateSignedResourceAsync(string bucketKey, string objectKey, Access? access = null, bool? useCdn = default(bool?), CreateSignedResource createSignedResource = default(CreateSignedResource), string accessToken = null, bool throwOnError = true) + public async System.Threading.Tasks.Task CreateSignedResourceAsync(string accessToken, string bucketKey, string objectKey, CreateSignedResource createSignedResource, Access? access = null, bool? useCdn = default(bool?), bool throwOnError = true) { var response = await this.objectsApi.CreateSignedResourceAsync(bucketKey, objectKey, access, useCdn, createSignedResource, accessToken, throwOnError); return response.Content; @@ -341,7 +354,7 @@ public async System.Threading.Tasks.Task CreateBucketAsync(Region xAdsRe /// /// Task of HttpResponseMessage - public async System.Threading.Tasks.Task DeleteBucketAsync(string bucketKey, string accessToken = null, bool throwOnError = true) + public async System.Threading.Tasks.Task DeleteBucketAsync(string accessToken, string bucketKey, bool throwOnError = true) { var response = await this.bucketsApi.DeleteBucketAsync(bucketKey, accessToken, throwOnError); return response; @@ -370,7 +383,7 @@ public async System.Threading.Tasks.Task DeleteBucketAsync( /// /// Task of HttpResponseMessage - public async System.Threading.Tasks.Task DeleteObjectAsync(string bucketKey, string objectKey, string xAdsAcmNamespace = default(string), string xAdsAcmCheckGroups = default(string), string xAdsAcmGroups = default(string), string accessToken = null, bool throwOnError = true) + public async System.Threading.Tasks.Task DeleteObjectAsync(string accessToken, string bucketKey, string objectKey, string xAdsAcmNamespace = default(string), string xAdsAcmCheckGroups = default(string), string xAdsAcmGroups = default(string), bool throwOnError = true) { var response = await this.objectsApi.DeleteObjectAsync(bucketKey, objectKey, xAdsAcmNamespace, xAdsAcmCheckGroups, xAdsAcmGroups, accessToken, throwOnError); return response; @@ -401,7 +414,7 @@ public async System.Threading.Tasks.Task DeleteBucketAsync( /// /// Task of HttpResponseMessage - public async System.Threading.Tasks.Task DeleteSignedResourceAsync(string hash, Region? region = null, string accessToken = null, bool throwOnError = true) + public async System.Threading.Tasks.Task DeleteSignedResourceAsync(string accessToken, string hash, Region? region = null, bool throwOnError = true) { var response = await this.objectsApi.DeleteSignedResourceAsync(hash, region, accessToken, throwOnError); return response; @@ -420,7 +433,7 @@ public async System.Threading.Tasks.Task DeleteSignedResour /// /// Task of <Bucket> - public async System.Threading.Tasks.Task GetBucketDetailsAsync(string bucketKey, string accessToken = null, bool throwOnError = true) + public async System.Threading.Tasks.Task GetBucketDetailsAsync(string accessToken, string bucketKey, bool throwOnError = true) { var response = await this.bucketsApi.GetBucketDetailsAsync(bucketKey, accessToken, throwOnError); return response.Content; @@ -449,7 +462,7 @@ public async System.Threading.Tasks.Task GetBucketDetailsAsync(string bu ///The ID of the last item that was returned in the previous result set. It enables the system to return subsequent items starting from the next one after the specified ID. (optional) /// /// Task of <Buckets> - public async System.Threading.Tasks.Task GetBucketsAsync(Region? region = null, int? limit = default(int?), string startAt = default(string), string accessToken = null, bool throwOnError = true) + public async System.Threading.Tasks.Task GetBucketsAsync(string accessToken, Region? region = null, int? limit = default(int?), string startAt = default(string), bool throwOnError = true) { var response = await this.bucketsApi.GetBucketsAsync(region, limit, startAt, accessToken, throwOnError); return response.Content; @@ -483,7 +496,7 @@ public async System.Threading.Tasks.Task GetBucketDetailsAsync(string bu /// (optional) /// /// Task of <ObjectFullDetails> - public async System.Threading.Tasks.Task GetObjectDetailsAsync(string bucketKey, string objectKey, DateTime? ifModifiedSince = default(DateTime?), string xAdsAcmNamespace = default(string), string xAdsAcmCheckGroups = default(string), string xAdsAcmGroups = default(string), With? with = null, string accessToken = null, bool throwOnError = true) + public async System.Threading.Tasks.Task GetObjectDetailsAsync(string accessToken, string bucketKey, string objectKey, DateTime? ifModifiedSince = default(DateTime?), string xAdsAcmNamespace = default(string), string xAdsAcmCheckGroups = default(string), string xAdsAcmGroups = default(string), With? with = null, bool throwOnError = true) { var response = await this.objectsApi.GetObjectDetailsAsync(bucketKey, objectKey, ifModifiedSince, xAdsAcmNamespace, xAdsAcmCheckGroups, xAdsAcmGroups, with, accessToken, throwOnError); return response.Content; @@ -511,7 +524,7 @@ public async System.Threading.Tasks.Task GetBucketDetailsAsync(string bu ///The ID of the last item that was returned in the previous result set. It enables the system to return subsequent items starting from the next one after the specified ID. (optional) /// /// Task of <BucketObjects> - public async System.Threading.Tasks.Task GetObjectsAsync(string bucketKey, int? limit = default(int?), string beginsWith = default(string), string startAt = default(string), string accessToken = null, bool throwOnError = true) + public async System.Threading.Tasks.Task GetObjectsAsync(string accessToken, string bucketKey, int? limit = default(int?), string beginsWith = default(string), string startAt = default(string), bool throwOnError = true) { var response = await this.objectsApi.GetObjectsAsync(bucketKey, limit, beginsWith, startAt, accessToken, throwOnError); return response.Content; @@ -562,7 +575,7 @@ public async System.Threading.Tasks.Task GetBucketDetailsAsync(string bu ///The value of the Content-Type header you want to receive when you download the object using the signed URL. If you do not specify a value, the Content-Type header defaults to the value stored with OSS. (optional) /// /// Task of <System.IO.Stream> - public async System.Threading.Tasks.Task GetSignedResourceAsync(string hash, string range = default(string), string ifNoneMatch = default(string), DateTime? ifModifiedSince = default(DateTime?), string acceptEncoding = default(string), Region? region = null, string responseContentDisposition = default(string), string responseContentType = default(string), string accessToken = null, bool throwOnError = true) + public async System.Threading.Tasks.Task GetSignedResourceAsync(string accessToken, string hash, string range = default(string), string ifNoneMatch = default(string), DateTime? ifModifiedSince = default(DateTime?), string acceptEncoding = default(string), Region? region = null, string responseContentDisposition = default(string), string responseContentType = default(string), bool throwOnError = true) { var response = await this.objectsApi.GetSignedResourceAsync(hash, range, ifNoneMatch, ifModifiedSince, acceptEncoding, region, responseContentDisposition, responseContentType, accessToken, throwOnError); return response.Content; @@ -628,7 +641,7 @@ public async System.Threading.Tasks.Task GetBucketDetailsAsync(string bu /// /// Task of <Signeds3downloadResponse> - public async System.Threading.Tasks.Task SignedS3DownloadAsync(string bucketKey, string objectKey, string ifNoneMatch = default(string), DateTime? ifModifiedSince = default(DateTime?), string xAdsAcmScopes = default(string), string responseContentType = default(string), string responseContentDisposition = default(string), string responseCacheControl = default(string), bool? publicResourceFallback = default(bool?), int? minutesExpiration = default(int?), bool? useCdn = default(bool?), bool? redirect = default(bool?), string accessToken = null, bool throwOnError = true) + public async System.Threading.Tasks.Task SignedS3DownloadAsync(string accessToken, string bucketKey, string objectKey, string ifNoneMatch = default(string), DateTime? ifModifiedSince = default(DateTime?), string xAdsAcmScopes = default(string), string responseContentType = default(string), string responseContentDisposition = default(string), string responseCacheControl = default(string), bool? publicResourceFallback = default(bool?), int? minutesExpiration = default(int?), bool? useCdn = default(bool?), bool? redirect = default(bool?), bool throwOnError = true) { var response = await this.objectsApi.SignedS3DownloadAsync(bucketKey, objectKey, ifNoneMatch, ifModifiedSince, xAdsAcmScopes, responseContentType, responseContentDisposition, responseCacheControl, publicResourceFallback, minutesExpiration, useCdn, redirect, accessToken, throwOnError); return response.Content; @@ -678,7 +691,7 @@ public async System.Threading.Tasks.Task GetBucketDetailsAsync(string bu /// /// Task of <Signeds3uploadResponse> - public async System.Threading.Tasks.Task SignedS3UploadAsync(string bucketKey, string objectKey, string xAdsAcmScopes = default(string), int? parts = default(int?), int? firstPart = default(int?), string uploadKey = default(string), int? minutesExpiration = default(int?), bool? useAcceleration = default(bool?), string accessToken = null, bool throwOnError = true) + public async System.Threading.Tasks.Task SignedS3UploadAsync(string accessToken, string bucketKey, string objectKey, string xAdsAcmScopes = default(string), int? parts = default(int?), int? firstPart = default(int?), string uploadKey = default(string), int? minutesExpiration = default(int?), bool? useAcceleration = default(bool?), bool throwOnError = true) { var response = await this.objectsApi.SignedS3UploadAsync(bucketKey, objectKey, xAdsAcmScopes, parts, firstPart, uploadKey, minutesExpiration, useAcceleration, accessToken, throwOnError); return response.Content; @@ -726,7 +739,7 @@ public async System.Threading.Tasks.Task GetBucketDetailsAsync(string bu /// /// Task of <ObjectDetails> - public async System.Threading.Tasks.Task UploadSignedResourceAsync(string hash, int? contentLength, System.IO.Stream body, string contentType = default(string), string contentDisposition = default(string), Region? xAdsRegion = null, string ifMatch = default(string), string accessToken = null, bool throwOnError = true) + public async System.Threading.Tasks.Task UploadSignedResourceAsync(string accessToken, string hash, int? contentLength, System.IO.Stream body, string contentType = default(string), string contentDisposition = default(string), Region? xAdsRegion = null, string ifMatch = default(string), bool throwOnError = true) { var response = await this.objectsApi.UploadSignedResourceAsync(hash, contentLength, body, contentType, contentDisposition, xAdsRegion, ifMatch, accessToken, throwOnError); return response.Content; @@ -771,7 +784,7 @@ public async System.Threading.Tasks.Task GetBucketDetailsAsync(string bu /// /// Task of <ObjectDetails> - public async System.Threading.Tasks.Task UploadSignedResourcesChunkAsync(string hash, string contentRange, string sessionId, System.IO.Stream body, string contentType = default(string), string contentDisposition = default(string), Region? xAdsRegion = null, string accessToken = null, bool throwOnError = true) + public async System.Threading.Tasks.Task UploadSignedResourcesChunkAsync(string accessToken, string hash, string contentRange, string sessionId, System.IO.Stream body, string contentType = default(string), string contentDisposition = default(string), Region? xAdsRegion = null, bool throwOnError = true) { var response = await this.objectsApi.UploadSignedResourcesChunkAsync(hash, contentRange, sessionId, body, contentType, contentDisposition, xAdsRegion, accessToken, throwOnError); return response.Content; diff --git a/samples/oss.cs b/samples/oss.cs index bd8caf7..cf67f7d 100644 --- a/samples/oss.cs +++ b/samples/oss.cs @@ -9,7 +9,7 @@ class OSS string token = ""; string bucketKey = ""; string objectName = ""; - string sourceToUpload = ""; + string sourceToUpload = "";//sourceToUpload can also be a stream object string filePath =""; OssClient ossClient = null!; @@ -39,6 +39,8 @@ public async Task Upload() { //The below helper method takes care of the complete upload process, i.e. // the steps 2 to 4 in this link (https://aps.autodesk.com/en/docs/data/v2/tutorials/app-managed-bucket/) + + //sourceToUpload can be either file path or stream of the object ObjectDetails objectDetails = await ossClient.Upload(bucketKey, objectName, sourceToUpload, accessToken: token, CancellationToken.None); // query for required properties string objectId = objectDetails.ObjectId;