From 37ee8c3bc421992442c4b8c6a78db4c81c3a6fca Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Fri, 13 Dec 2024 14:24:13 -0300 Subject: [PATCH 01/10] Create `Autodesk.Forge` internal project --- .../Autodesk.Forge.Oss.Tests.csproj | 1 + Autodesk.Forge.Oss.sln | 8 +- Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj | 23 +- Autodesk.Forge/Api/BucketsApi.cs | 989 ++++ Autodesk.Forge/Api/ObjectsApi.cs | 5042 +++++++++++++++++ Autodesk.Forge/Api/TwoLeggedApi.cs | 391 ++ Autodesk.Forge/Autodesk.Forge.csproj | 25 + Autodesk.Forge/Client/ApiClient.cs | 560 ++ Autodesk.Forge/Client/ApiException.cs | 72 + Autodesk.Forge/Client/ApiResponse.cs | 66 + Autodesk.Forge/Client/Configuration.cs | 352 ++ Autodesk.Forge/Client/ExceptionFactory.cs | 36 + Autodesk.Forge/Client/IApiAccessor.cs | 53 + Autodesk.Forge/LICENSE | 201 + Autodesk.Forge/Model/Bearer.cs | 229 + Autodesk.Forge/Model/Bucket.cs | 191 + Autodesk.Forge/Model/BucketObjects.cs | 143 + Autodesk.Forge/Model/Buckets.cs | 165 + Autodesk.Forge/Model/BucketsItems.cs | 218 + Autodesk.Forge/Model/Constants.cs | 43 + Autodesk.Forge/Model/DownloadItemDesc.cs | 114 + Autodesk.Forge/Model/DynamicJsonResponse.cs | 417 ++ Autodesk.Forge/Model/ObjectDetails.cs | 224 + Autodesk.Forge/Model/ObjectFullDetails.cs | 256 + .../Model/ObjectFullDetailsDeltas.cs | 142 + Autodesk.Forge/Model/Permission.cs | 144 + .../Model/PostBatchCompleteS3UploadPayload.cs | 283 + .../Model/PostBatchSignedS3DownloadPayload.cs | 258 + .../Model/PostBatchSignedS3UploadPayload.cs | 228 + .../Model/PostBatchSignedS3UploadResponse.cs | 122 + Autodesk.Forge/Model/PostBucketsPayload.cs | 208 + .../Model/PostBucketsPayloadAllow.cs | 186 + Autodesk.Forge/Model/PostBucketsSigned.cs | 141 + .../Model/PostCompleteS3UploadPayload.cs | 134 + Autodesk.Forge/Model/PostObjectSigned.cs | 165 + Autodesk.Forge/Model/Scope.cs | 112 + Autodesk.Forge/Model/UploadItemDesc.cs | 139 + Autodesk.Forge/README.md | 18 + CHANGELOG.md | 7 + 39 files changed, 12103 insertions(+), 3 deletions(-) create mode 100644 Autodesk.Forge/Api/BucketsApi.cs create mode 100644 Autodesk.Forge/Api/ObjectsApi.cs create mode 100644 Autodesk.Forge/Api/TwoLeggedApi.cs create mode 100644 Autodesk.Forge/Autodesk.Forge.csproj create mode 100644 Autodesk.Forge/Client/ApiClient.cs create mode 100644 Autodesk.Forge/Client/ApiException.cs create mode 100644 Autodesk.Forge/Client/ApiResponse.cs create mode 100644 Autodesk.Forge/Client/Configuration.cs create mode 100644 Autodesk.Forge/Client/ExceptionFactory.cs create mode 100644 Autodesk.Forge/Client/IApiAccessor.cs create mode 100644 Autodesk.Forge/LICENSE create mode 100644 Autodesk.Forge/Model/Bearer.cs create mode 100644 Autodesk.Forge/Model/Bucket.cs create mode 100644 Autodesk.Forge/Model/BucketObjects.cs create mode 100644 Autodesk.Forge/Model/Buckets.cs create mode 100644 Autodesk.Forge/Model/BucketsItems.cs create mode 100644 Autodesk.Forge/Model/Constants.cs create mode 100644 Autodesk.Forge/Model/DownloadItemDesc.cs create mode 100644 Autodesk.Forge/Model/DynamicJsonResponse.cs create mode 100644 Autodesk.Forge/Model/ObjectDetails.cs create mode 100644 Autodesk.Forge/Model/ObjectFullDetails.cs create mode 100644 Autodesk.Forge/Model/ObjectFullDetailsDeltas.cs create mode 100644 Autodesk.Forge/Model/Permission.cs create mode 100644 Autodesk.Forge/Model/PostBatchCompleteS3UploadPayload.cs create mode 100644 Autodesk.Forge/Model/PostBatchSignedS3DownloadPayload.cs create mode 100644 Autodesk.Forge/Model/PostBatchSignedS3UploadPayload.cs create mode 100644 Autodesk.Forge/Model/PostBatchSignedS3UploadResponse.cs create mode 100644 Autodesk.Forge/Model/PostBucketsPayload.cs create mode 100644 Autodesk.Forge/Model/PostBucketsPayloadAllow.cs create mode 100644 Autodesk.Forge/Model/PostBucketsSigned.cs create mode 100644 Autodesk.Forge/Model/PostCompleteS3UploadPayload.cs create mode 100644 Autodesk.Forge/Model/PostObjectSigned.cs create mode 100644 Autodesk.Forge/Model/Scope.cs create mode 100644 Autodesk.Forge/Model/UploadItemDesc.cs create mode 100644 Autodesk.Forge/README.md diff --git a/Autodesk.Forge.Oss.Tests/Autodesk.Forge.Oss.Tests.csproj b/Autodesk.Forge.Oss.Tests/Autodesk.Forge.Oss.Tests.csproj index 826a3b1..82df46e 100644 --- a/Autodesk.Forge.Oss.Tests/Autodesk.Forge.Oss.Tests.csproj +++ b/Autodesk.Forge.Oss.Tests/Autodesk.Forge.Oss.Tests.csproj @@ -13,6 +13,7 @@ + diff --git a/Autodesk.Forge.Oss.sln b/Autodesk.Forge.Oss.sln index 94058dc..914bf28 100644 --- a/Autodesk.Forge.Oss.sln +++ b/Autodesk.Forge.Oss.sln @@ -14,7 +14,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution", "Solution", "{D6 README.md = README.md EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Autodesk.Forge.Oss.Tests", "Autodesk.Forge.Oss.Tests\Autodesk.Forge.Oss.Tests.csproj", "{6CF07E6C-9623-4B4E-A549-59ABDC74537D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Autodesk.Forge.Oss.Tests", "Autodesk.Forge.Oss.Tests\Autodesk.Forge.Oss.Tests.csproj", "{6CF07E6C-9623-4B4E-A549-59ABDC74537D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Autodesk.Forge", "Autodesk.Forge\Autodesk.Forge.csproj", "{A30518D1-F6D0-4190-81A7-142088761FB2}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -32,6 +34,10 @@ Global {6CF07E6C-9623-4B4E-A549-59ABDC74537D}.Debug|Any CPU.Build.0 = Debug|Any CPU {6CF07E6C-9623-4B4E-A549-59ABDC74537D}.Release|Any CPU.ActiveCfg = Release|Any CPU {6CF07E6C-9623-4B4E-A549-59ABDC74537D}.Release|Any CPU.Build.0 = Release|Any CPU + {A30518D1-F6D0-4190-81A7-142088761FB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A30518D1-F6D0-4190-81A7-142088761FB2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A30518D1-F6D0-4190-81A7-142088761FB2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A30518D1-F6D0-4190-81A7-142088761FB2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj b/Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj index 600930d..3d4f393 100644 --- a/Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj +++ b/Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj @@ -14,9 +14,28 @@ - + + + + + + + $(TargetsForTfmSpecificContentInPackage);CustomContentTarget + + + + + + lib/$(TargetFramework) + + + lib/$(TargetFramework) + + + + true @@ -36,7 +55,7 @@ ricaun.Autodesk.Forge.Oss - 2.1.0 + 2.2.0-alpha {54AC7247-0A9C-4A56-835B-D1790800647B} diff --git a/Autodesk.Forge/Api/BucketsApi.cs b/Autodesk.Forge/Api/BucketsApi.cs new file mode 100644 index 0000000..77e9ab0 --- /dev/null +++ b/Autodesk.Forge/Api/BucketsApi.cs @@ -0,0 +1,989 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using RestSharp; +using Newtonsoft.Json.Linq; +using Autodesk.Forge.Client; +using Autodesk.Forge.Model; + +namespace Autodesk.Forge { + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IBucketsApi : IApiAccessor { + #region Synchronous Operations + /// + /// + /// + /// + /// Use this endpoint to create a bucket. Buckets are arbitrary spaces created and owned by applications. Bucket keys are globally unique across all regions, regardless of where they were created, and they cannot be changed. The application creating the bucket is the owner of the bucket. + /// + /// Thrown when fails to make API call + /// Body Structure + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Bucket + /*Bucket*/ + dynamic CreateBucket (PostBucketsPayload postBuckets, string xAdsRegion = null); + + /// + /// + /// + /// + /// Use this endpoint to create a bucket. Buckets are arbitrary spaces created and owned by applications. Bucket keys are globally unique across all regions, regardless of where they were created, and they cannot be changed. The application creating the bucket is the owner of the bucket. + /// + /// Thrown when fails to make API call + /// Body Structure + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// ApiResponse of Bucket + ApiResponse CreateBucketWithHttpInfo (PostBucketsPayload postBuckets, string xAdsRegion = null); + /// + /// + /// + /// + /// This endpoint will delete a bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// + void DeleteBucket (string bucketKey); + + /// + /// + /// + /// + /// This endpoint will delete a bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// ApiResponse of Object(void) + ApiResponse DeleteBucketWithHttpInfo (string bucketKey); + /// + /// + /// + /// + /// This endpoint will return the buckets owned by the application. This endpoint supports pagination. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// Bucket + /*Bucket*/ + dynamic GetBucketDetails (string bucketKey); + + /// + /// + /// + /// + /// This endpoint will return the buckets owned by the application. This endpoint supports pagination. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// ApiResponse of Bucket + ApiResponse GetBucketDetailsWithHttpInfo (string bucketKey); + /// + /// + /// + /// + /// This endpoint will return the buckets owned by the application. This endpoint supports pagination. + /// + /// Thrown when fails to make API call + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Limit to the response size, Acceptable values: 1-100 Default = 10 (optional, default to 10) + /// Key to use as an offset to continue pagination This is typically the last bucket key found in a preceding GET buckets response (optional) + /// Buckets + /*Buckets*/ + dynamic GetBuckets (string region = null, int? limit = null, string startAt = null); + + /// + /// + /// + /// + /// This endpoint will return the buckets owned by the application. This endpoint supports pagination. + /// + /// Thrown when fails to make API call + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Limit to the response size, Acceptable values: 1-100 Default = 10 (optional, default to 10) + /// Key to use as an offset to continue pagination This is typically the last bucket key found in a preceding GET buckets response (optional) + /// ApiResponse of Buckets + ApiResponse GetBucketsWithHttpInfo (string region = null, int? limit = null, string startAt = null); + #endregion Synchronous Operations + #region Asynchronous Operations + /// + /// + /// + /// + /// Use this endpoint to create a bucket. Buckets are arbitrary spaces created and owned by applications. Bucket keys are globally unique across all regions, regardless of where they were created, and they cannot be changed. The application creating the bucket is the owner of the bucket. + /// + /// Thrown when fails to make API call + /// Body Structure + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Task of Bucket + System.Threading.Tasks.Task CreateBucketAsync (PostBucketsPayload postBuckets, string xAdsRegion = null); + + /// + /// + /// + /// + /// Use this endpoint to create a bucket. Buckets are arbitrary spaces created and owned by applications. Bucket keys are globally unique across all regions, regardless of where they were created, and they cannot be changed. The application creating the bucket is the owner of the bucket. + /// + /// Thrown when fails to make API call + /// Body Structure + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Task of ApiResponse (Bucket) + System.Threading.Tasks.Task> CreateBucketAsyncWithHttpInfo (PostBucketsPayload postBuckets, string xAdsRegion = null); + + /// + /// + /// + /// + /// This endpoint will delete a bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// Task of void + System.Threading.Tasks.Task DeleteBucketAsync (string bucketKey); + + /// + /// + /// + /// + /// This endpoint will delete a bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// Task of ApiResponse + System.Threading.Tasks.Task> DeleteBucketAsyncWithHttpInfo (string bucketKey); + + /// + /// + /// + /// + /// This endpoint will return the buckets owned by the application. This endpoint supports pagination. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// Task of Bucket + System.Threading.Tasks.Task GetBucketDetailsAsync (string bucketKey); + + /// + /// + /// + /// + /// This endpoint will return the buckets owned by the application. This endpoint supports pagination. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// Task of ApiResponse (Bucket) + System.Threading.Tasks.Task> GetBucketDetailsAsyncWithHttpInfo (string bucketKey); + + /// + /// + /// + /// + /// This endpoint will return the buckets owned by the application. This endpoint supports pagination. + /// + /// Thrown when fails to make API call + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Limit to the response size, Acceptable values: 1-100 Default = 10 (optional, default to 10) + /// Key to use as an offset to continue pagination This is typically the last bucket key found in a preceding GET buckets response (optional) + /// Task of Buckets + System.Threading.Tasks.Task GetBucketsAsync (string region = null, int? limit = null, string startAt = null); + + /// + /// + /// + /// + /// This endpoint will return the buckets owned by the application. This endpoint supports pagination. + /// + /// Thrown when fails to make API call + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Limit to the response size, Acceptable values: 1-100 Default = 10 (optional, default to 10) + /// Key to use as an offset to continue pagination This is typically the last bucket key found in a preceding GET buckets response (optional) + /// Task of ApiResponse (Buckets) + System.Threading.Tasks.Task> GetBucketsAsyncWithHttpInfo (string region = null, int? limit = null, string startAt = null); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class BucketsApi : IBucketsApi { + + private Autodesk.Forge.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public BucketsApi (String basePath) { + this.Configuration = new Configuration (new ApiClient (basePath)); + + ExceptionFactory = Autodesk.Forge.Client.Configuration.DefaultExceptionFactory; + + // ensure API client has configuration ready + if ( Configuration.ApiClient.Configuration == null ) { + this.Configuration.ApiClient.Configuration = this.Configuration; + } + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public BucketsApi (Configuration configuration = null) { + if ( configuration == null ) // use the default one in Configuration + this.Configuration = Configuration.Default; + else + this.Configuration = configuration; + + ExceptionFactory = Autodesk.Forge.Client.Configuration.DefaultExceptionFactory; + + // ensure API client has configuration ready + if ( Configuration.ApiClient.Configuration == null ) { + Configuration.ApiClient.Configuration = this.Configuration; + } + } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath () { + return Configuration.ApiClient.RestClient.Options.BaseUrl.ToString (); + } + + /// + /// Sets the base path of the API client. + /// + /// The base path + [Obsolete ("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")] + public void SetBasePath (String basePath) { + // do nothing + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Configuration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Autodesk.Forge.Client.ExceptionFactory ExceptionFactory { + get { + if ( _exceptionFactory != null && _exceptionFactory.GetInvocationList ().Length > 1 ) { + throw new InvalidOperationException ("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Gets the default header. + /// + /// Dictionary of HTTP header + [Obsolete ("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] + public Dictionary DefaultHeader () { + return this.Configuration.DefaultHeader; + } + + /// + /// Add default header. + /// + /// Header field name. + /// Header field value. + /// + [Obsolete ("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")] + public void AddDefaultHeader (string key, string value) { + this.Configuration.AddDefaultHeader (key, value); + } + + /// + /// Use this endpoint to create a bucket. Buckets are arbitrary spaces created and owned by applications. Bucket keys are globally unique across all regions, regardless of where they were created, and they cannot be changed. The application creating the bucket is the owner of the bucket. + /// + /// Thrown when fails to make API call + /// Body Structure + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Bucket + public /*Bucket*/dynamic CreateBucket (PostBucketsPayload postBuckets, string xAdsRegion = null) { + ApiResponse localVarResponse = CreateBucketWithHttpInfo (postBuckets, xAdsRegion); + return localVarResponse.Data; + } + + /// + /// Use this endpoint to create a bucket. Buckets are arbitrary spaces created and owned by applications. Bucket keys are globally unique across all regions, regardless of where they were created, and they cannot be changed. The application creating the bucket is the owner of the bucket. + /// + /// Thrown when fails to make API call + /// Body Structure + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// ApiResponse of Bucket + public ApiResponse CreateBucketWithHttpInfo (PostBucketsPayload postBuckets, string xAdsRegion = null) { + // verify the required parameter 'postBuckets' is set + if ( postBuckets == null ) + throw new ApiException (400, "Missing required parameter 'postBuckets' when calling BucketsApi->CreateBucket"); + + var localVarPath = "/oss/v2/buckets"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( xAdsRegion != null && localVarHeaderParams.ContainsKey ("x-ads-region") ) + localVarHeaderParams ["x-ads-region"] = Configuration.ApiClient.ParameterToString (xAdsRegion); // header parameter + else if ( xAdsRegion != null ) + localVarHeaderParams.Add ("x-ads-region", Configuration.ApiClient.ParameterToString (xAdsRegion)); // header parameter + if ( postBuckets != null && postBuckets.GetType () == typeof (byte []) ) // http body (model) parameter + { + localVarPostBody = postBuckets; // byte array + } else if ( postBuckets != null + && (postBuckets.GetType () == typeof (System.IO.FileStream) + || postBuckets.GetType () == typeof (System.IO.BinaryReader) + || postBuckets.GetType () == typeof (System.IO.BufferedStream) + || postBuckets.GetType () == typeof (System.IO.MemoryStream) + || postBuckets.GetType () == typeof (System.IO.StreamReader) + ) + ) { + localVarPostBody = Configuration.ApiClient.toByteArray (postBuckets); // byte array + } else if ( postBuckets != null ) { + localVarPostBody = Configuration.ApiClient.Serialize (postBuckets); + } + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)Configuration.ApiClient.CallApi (localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("CreateBucket", localVarResponse); + if ( exception != null ) + throw exception; + } + + ApiResponse apiResponse = new ApiResponse ( + localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(Bucket)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (Bucket)) + ); + return apiResponse; + } + + /// + /// Use this endpoint to create a bucket. Buckets are arbitrary spaces created and owned by applications. Bucket keys are globally unique across all regions, regardless of where they were created, and they cannot be changed. The application creating the bucket is the owner of the bucket. + /// + /// Thrown when fails to make API call + /// Body Structure + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Task of Bucket + public async System.Threading.Tasks.Task CreateBucketAsync (PostBucketsPayload postBuckets, string xAdsRegion = null) { + ApiResponse localVarResponse = await CreateBucketAsyncWithHttpInfo (postBuckets, xAdsRegion); + return localVarResponse.Data; + + } + + /// + /// Use this endpoint to create a bucket. Buckets are arbitrary spaces created and owned by applications. Bucket keys are globally unique across all regions, regardless of where they were created, and they cannot be changed. The application creating the bucket is the owner of the bucket. + /// + /// Thrown when fails to make API call + /// Body Structure + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Task of ApiResponse (Bucket) + public async System.Threading.Tasks.Task> CreateBucketAsyncWithHttpInfo (PostBucketsPayload postBuckets, string xAdsRegion = null) { + // verify the required parameter 'postBuckets' is set + if ( postBuckets == null ) + throw new ApiException (400, "Missing required parameter 'postBuckets' when calling BucketsApi->CreateBucket"); + + var localVarPath = "/oss/v2/buckets"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( xAdsRegion != null && localVarHeaderParams.ContainsKey ("x-ads-region") ) + localVarHeaderParams ["x-ads-region"] = Configuration.ApiClient.ParameterToString (xAdsRegion); // header parameter + else if (xAdsRegion != null ) + localVarHeaderParams.Add ("x-ads-region", Configuration.ApiClient.ParameterToString (xAdsRegion)); // header parameter + if ( postBuckets != null && postBuckets.GetType () == typeof (byte []) ) // http body (model) parameter + { + localVarPostBody = postBuckets; // byte array + } else if ( postBuckets != null + && (postBuckets.GetType () == typeof (System.IO.FileStream) + || postBuckets.GetType () == typeof (System.IO.BinaryReader) + || postBuckets.GetType () == typeof (System.IO.BufferedStream) + || postBuckets.GetType () == typeof (System.IO.MemoryStream) + || postBuckets.GetType () == typeof (System.IO.StreamReader) + ) + ) { + localVarPostBody = Configuration.ApiClient.toByteArray (postBuckets); // byte array + } else if ( postBuckets != null ) { + localVarPostBody = Configuration.ApiClient.Serialize (postBuckets); + } + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync (localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("CreateBucket", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(Bucket)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (Bucket))); + + } + + /// + /// This endpoint will delete a bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// + public void DeleteBucket (string bucketKey) { + DeleteBucketWithHttpInfo (bucketKey); + } + + /// + /// This endpoint will delete a bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// ApiResponse of Object(void) + public ApiResponse DeleteBucketWithHttpInfo (string bucketKey) { + // verify the required parameter 'bucketKey' is set + if ( bucketKey == null ) + throw new ApiException (400, "Missing required parameter 'bucketKey' when calling BucketsApi->DeleteBucket"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( bucketKey != null ) + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)Configuration.ApiClient.CallApi (localVarPath, + Method.Delete, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("DeleteBucket", localVarResponse); + if ( exception != null ) + throw exception; + } + + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + null); + } + + /// + /// This endpoint will delete a bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// Task of void + public async System.Threading.Tasks.Task DeleteBucketAsync (string bucketKey) { + await DeleteBucketAsyncWithHttpInfo (bucketKey); + + } + + /// + /// This endpoint will delete a bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// Task of ApiResponse + public async System.Threading.Tasks.Task> DeleteBucketAsyncWithHttpInfo (string bucketKey) { + // verify the required parameter 'bucketKey' is set + if ( bucketKey == null ) + throw new ApiException (400, "Missing required parameter 'bucketKey' when calling BucketsApi->DeleteBucket"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( bucketKey != null ) + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync (localVarPath, + Method.Delete, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("DeleteBucket", localVarResponse); + if ( exception != null ) + throw exception; + } + + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + null); + } + + /// + /// This endpoint will return the buckets owned by the application. This endpoint supports pagination. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// Bucket + public /*Bucket*/dynamic GetBucketDetails (string bucketKey) { + ApiResponse localVarResponse = GetBucketDetailsWithHttpInfo (bucketKey); + return localVarResponse.Data; + } + + /// + /// This endpoint will return the buckets owned by the application. This endpoint supports pagination. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// ApiResponse of Bucket + public ApiResponse< /*Bucket*/dynamic> GetBucketDetailsWithHttpInfo (string bucketKey) { + // verify the required parameter 'bucketKey' is set + if ( bucketKey == null ) + throw new ApiException (400, "Missing required parameter 'bucketKey' when calling BucketsApi->GetBucketDetails"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/details"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( bucketKey != null ) + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)Configuration.ApiClient.CallApi (localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("GetBucketDetails", localVarResponse); + if ( exception != null ) + throw exception; + } + + ApiResponse apiResponse = new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(Bucket)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (Bucket))); + return apiResponse; + + } + + /// + /// This endpoint will return the buckets owned by the application. This endpoint supports pagination. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// Task of Bucket + public async System.Threading.Tasks.Task GetBucketDetailsAsync (string bucketKey) { + ApiResponse localVarResponse = await GetBucketDetailsAsyncWithHttpInfo (bucketKey); + return localVarResponse.Data; + + } + + /// + /// This endpoint will return the buckets owned by the application. This endpoint supports pagination. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// Task of ApiResponse (Bucket) + public async System.Threading.Tasks.Task> GetBucketDetailsAsyncWithHttpInfo (string bucketKey) { + // verify the required parameter 'bucketKey' is set + if ( bucketKey == null ) + throw new ApiException (400, "Missing required parameter 'bucketKey' when calling BucketsApi->GetBucketDetails"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/details"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + //localVarPathParams.Add("format", "json"); + if ( bucketKey != null ) + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync (localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("GetBucketDetails", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(Bucket)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (Bucket))); + + } + + /// + /// This endpoint will return the buckets owned by the application. This endpoint supports pagination. + /// + /// Thrown when fails to make API call + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Limit to the response size, Acceptable values: 1-100 Default = 10 (optional, default to 10) + /// Key to use as an offset to continue pagination This is typically the last bucket key found in a preceding GET buckets response (optional) + /// Buckets + public /*Buckets*/dynamic GetBuckets (string region = null, int? limit = null, string startAt = null) { + ApiResponse localVarResponse = GetBucketsWithHttpInfo (region, limit, startAt); + return localVarResponse.Data; + } + + /// + /// This endpoint will return the buckets owned by the application. This endpoint supports pagination. + /// + /// Thrown when fails to make API call + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Limit to the response size, Acceptable values: 1-100 Default = 10 (optional, default to 10) + /// Key to use as an offset to continue pagination This is typically the last bucket key found in a preceding GET buckets response (optional) + /// ApiResponse of Buckets + public ApiResponse< /*Buckets*/dynamic> GetBucketsWithHttpInfo (string region = null, int? limit = null, string startAt = null) { + + var localVarPath = "/oss/v2/buckets"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( region != null ) + localVarQueryParams.Add ("region", Configuration.ApiClient.ParameterToString (region)); // query parameter + if ( limit != null ) + localVarQueryParams.Add ("limit", Configuration.ApiClient.ParameterToString (limit)); // query parameter + if ( startAt != null ) + localVarQueryParams.Add ("startAt", Configuration.ApiClient.ParameterToString (startAt)); // query parameter + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)Configuration.ApiClient.CallApi (localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("GetBuckets", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(Buckets)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (Buckets))); + + } + + /// + /// This endpoint will return the buckets owned by the application. This endpoint supports pagination. + /// + /// Thrown when fails to make API call + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Limit to the response size, Acceptable values: 1-100 Default = 10 (optional, default to 10) + /// Key to use as an offset to continue pagination This is typically the last bucket key found in a preceding GET buckets response (optional) + /// Task of Buckets + public async System.Threading.Tasks.Task GetBucketsAsync (string region = null, int? limit = null, string startAt = null) { + ApiResponse localVarResponse = await GetBucketsAsyncWithHttpInfo (region, limit, startAt); + return localVarResponse.Data; + + } + + /// + /// This endpoint will return the buckets owned by the application. This endpoint supports pagination. + /// + /// Thrown when fails to make API call + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Limit to the response size, Acceptable values: 1-100 Default = 10 (optional, default to 10) + /// Key to use as an offset to continue pagination This is typically the last bucket key found in a preceding GET buckets response (optional) + /// Task of ApiResponse (Buckets) + public async System.Threading.Tasks.Task> GetBucketsAsyncWithHttpInfo (string region = null, int? limit = null, string startAt = null) { + + var localVarPath = "/oss/v2/buckets"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( region != null ) + localVarQueryParams.Add ("region", Configuration.ApiClient.ParameterToString (region)); // query parameter + if ( limit != null ) + localVarQueryParams.Add ("limit", Configuration.ApiClient.ParameterToString (limit)); // query parameter + if ( startAt != null ) + localVarQueryParams.Add ("startAt", Configuration.ApiClient.ParameterToString (startAt)); // query parameter + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync (localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("GetBuckets", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(Buckets)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (Buckets))); + + } + + } +} diff --git a/Autodesk.Forge/Api/ObjectsApi.cs b/Autodesk.Forge/Api/ObjectsApi.cs new file mode 100644 index 0000000..fe5c78c --- /dev/null +++ b/Autodesk.Forge/Api/ObjectsApi.cs @@ -0,0 +1,5042 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using RestSharp; +using Newtonsoft.Json.Linq; +using Autodesk.Forge.Client; +using Autodesk.Forge.Model; +using System.Security.Cryptography; +using System.Net.Http; +using System.Diagnostics; +using System.IO; +using System.Net.Http.Headers; + +namespace Autodesk.Forge { + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IObjectsApi : IApiAccessor { + #region Synchronous Operations + + /// + /// + /// + /// + /// Copies an object to another object name in the same bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// URL-encoded Object key to use as the destination + /// ObjectDetails + /*ObjectDetails*/ + dynamic CopyTo (string bucketKey, string objectName, string newObjName); + + /// + /// + /// + /// + /// Copies an object to another object name in the same bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// URL-encoded Object key to use as the destination + /// ApiResponse of ObjectDetails + ApiResponse CopyToWithHttpInfo (string bucketKey, string objectName, string newObjName); + + /// + /// + /// + /// + /// This endpoint creates a signed URL that can be used to download an object within the specified expiration time. Be aware that if the object the signed URL points to is deleted or expires before the signed URL expires, then the signed URL will no longer be valid. A successful call to this endpoint requires bucket owner access. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Body Structure + /// Access for signed resource Acceptable values: `read`, `write`, `readwrite`. Default value: `read` (optional, default to read) + /// If true, this will generate a CloudFront URL for the S3 object + /// PostObjectSigned + /*PostObjectSigned*/ + dynamic CreateSignedResource (string bucketKey, string objectName, PostBucketsSigned postBucketsSigned, string access = null, bool useCdn = true); + + /// + /// + /// + /// + /// This endpoint creates a signed URL that can be used to download an object within the specified expiration time. Be aware that if the object the signed URL points to is deleted or expires before the signed URL expires, then the signed URL will no longer be valid. A successful call to this endpoint requires bucket owner access. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Body Structure + /// Access for signed resource Acceptable values: `read`, `write`, `readwrite`. Default value: `read` (optional, default to read) + /// If true, this will generate a CloudFront URL for the S3 object + /// ApiResponse of PostObjectSigned + ApiResponse CreateSignedResourceWithHttpInfo (string bucketKey, string objectName, PostBucketsSigned postBucketsSigned, string access = null, bool useCdn = true); + + /// + /// + /// + /// + /// Deletes an object from the bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// + void DeleteObject (string bucketKey, string objectName); + + /// + /// + /// + /// + /// Deletes an object from the bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// ApiResponse of Object(void) + ApiResponse DeleteObjectWithHttpInfo (string bucketKey, string objectName); + /// + /// + /// + /// + /// Delete a signed URL. A successful call to this endpoint requires bucket owner access. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// + void DeleteSignedResource (string id, string region = null); + + /// + /// + /// + /// + /// Delete a signed URL. A successful call to this endpoint requires bucket owner access. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// ApiResponse of Object(void) + ApiResponse DeleteSignedResourceWithHttpInfo (string id, string region = null); + + /// + /// + /// + /// + /// Download an object. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// A range of bytes to download from the specified object. (optional) + /// The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. (optional) + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. (optional) + /// System.IO.Stream + /*System.IO.Stream*/ + dynamic GetObject (string bucketKey, string objectName, string range = null, string ifNoneMatch = null, DateTime? ifModifiedSince = null, string acceptEncoding = null); + + /// + /// + /// + /// + /// Download an object. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// A range of bytes to download from the specified object. (optional) + /// The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. (optional) + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. (optional) + /// ApiResponse of System.IO.Stream + ApiResponse GetObjectWithHttpInfo (string bucketKey, string objectName, string range = null, string ifNoneMatch = null, DateTime? ifModifiedSince = null, string acceptEncoding = null); + + /// + /// + /// + /// + /// Returns object details in JSON format. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// Extra information in details; multiple uses are supported Acceptable values: `createdDate`, `lastAccessedDate`, `lastModifiedDate` (optional) + /// ObjectFullDetails + /*ObjectFullDetails*/ + dynamic GetObjectDetails (string bucketKey, string objectName, DateTime? ifModifiedSince = null, string with = null); + + /// + /// + /// + /// + /// Returns object details in JSON format. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// Extra information in details; multiple uses are supported Acceptable values: `createdDate`, `lastAccessedDate`, `lastModifiedDate` (optional) + /// ApiResponse of ObjectFullDetails + ApiResponse GetObjectDetailsWithHttpInfo (string bucketKey, string objectName, DateTime? ifModifiedSince = null, string with = null); + + /// + /// + /// + /// + /// List objects in a bucket. It is only available to the bucket creator. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// Limit to the response size, Acceptable values: 1-100 Default = 10 (optional, default to 10) + /// Provides a way to filter the based on object key name (optional) + /// Key to use as an offset to continue pagination This is typically the last bucket key found in a preceding GET buckets response (optional) + /// BucketObjects + /*BucketObjects*/ + dynamic GetObjects (string bucketKey, int? limit = null, string beginsWith = null, string startAt = null); + + /// + /// + /// + /// + /// List objects in a bucket. It is only available to the bucket creator. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// Limit to the response size, Acceptable values: 1-100 Default = 10 (optional, default to 10) + /// Provides a way to filter the based on object key name (optional) + /// Key to use as an offset to continue pagination This is typically the last bucket key found in a preceding GET buckets response (optional) + /// ApiResponse of BucketObjects + ApiResponse GetObjectsWithHttpInfo (string bucketKey, int? limit = null, string beginsWith = null, string startAt = null); + + /// + /// + /// + /// + /// Download an object using a signed URL. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// A range of bytes to download from the specified object. (optional) + /// The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. (optional) + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// System.IO.Stream + /*System.IO.Stream*/ + dynamic GetSignedResource (string id, string range = null, string ifNoneMatch = null, DateTime? ifModifiedSince = null, string acceptEncoding = null, string region = null); + + /// + /// + /// + /// + /// Download an object using a signed URL. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// A range of bytes to download from the specified object. (optional) + /// The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. (optional) + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// ApiResponse of System.IO.Stream + ApiResponse GetSignedResourceWithHttpInfo (string id, string range = null, string ifNoneMatch = null, DateTime? ifModifiedSince = null, string acceptEncoding = null, string region = null); + + /// + /// + /// + /// + /// This endpoint returns status information about a resumable upload. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Unique identifier of a session of a file being uploaded + /// + void GetStatusBySessionId (string bucketKey, string objectName, string sessionId); + + /// + /// + /// + /// + /// This endpoint returns status information about a resumable upload. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Unique identifier of a session of a file being uploaded + /// ApiResponse of Object(void) + ApiResponse GetStatusBySessionIdWithHttpInfo (string bucketKey, string objectName, string sessionId); + + /// + /// + /// + /// + /// This endpoint allows resumable uploads for large files in chunks. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Indicates the size of the request body. + /// Byte range of a segment being uploaded + /// Unique identifier of a session of a file being uploaded + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// ObjectDetails + /*ObjectDetails*/ + dynamic UploadChunk (string bucketKey, string objectName, int? contentLength, string contentRange, string sessionId, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream"); + + /// + /// + /// + /// + /// This endpoint allows resumable uploads for large files in chunks. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Indicates the size of the request body. + /// Byte range of a segment being uploaded + /// Unique identifier of a session of a file being uploaded + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// ApiResponse of ObjectDetails + ApiResponse UploadChunkWithHttpInfo (string bucketKey, string objectName, int? contentLength, string contentRange, string sessionId, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream"); + + /// + /// + /// + /// + /// Upload an object. If the specified object name already exists in the bucket, the uploaded content will overwrite the existing content for the bucket name/object name combination. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Indicates the size of the request body. + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// ObjectDetails + /*ObjectDetails*/ + dynamic UploadObject (string bucketKey, string objectName, int? contentLength, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream"); + + /// + /// + /// + /// + /// Upload an object. If the specified object name already exists in the bucket, the uploaded content will overwrite the existing content for the bucket name/object name combination. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Indicates the size of the request body. + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// ApiResponse of ObjectDetails + ApiResponse UploadObjectWithHttpInfo (string bucketKey, string objectName, int? contentLength, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream"); + + /// + /// + /// + /// + /// Overwrite a existing object using a signed URL. Conditions to call this operation: Object is available Expiration period is valid Signed URL should be created with `write` or `readwrite` + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// Indicates the size of the request body. + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// ObjectDetails + /*ObjectDetails*/ + dynamic UploadSignedResource (string id, int? contentLength, System.IO.Stream body, string contentDisposition = null, string xAdsRegion = null, string ifMatch = null, string contentType = "application/octet-stream"); + + /// + /// + /// + /// + /// Overwrite a existing object using a signed URL. Conditions to call this operation: Object is available Expiration period is valid Signed URL should be created with `write` or `readwrite` + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// Indicates the size of the request body. + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// ApiResponse of ObjectDetails + ApiResponse UploadSignedResourceWithHttpInfo (string id, int? contentLength, System.IO.Stream body, string contentDisposition = null, string xAdsRegion = null, string ifMatch = null, string contentType = "application/octet-stream"); + + /// + /// + /// + /// + /// Resumable upload for signed URLs. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// Byte range of a segment being uploaded + /// Unique identifier of a session of a file being uploaded + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// ObjectDetails + /*ObjectDetails*/ + dynamic UploadSignedResourcesChunk (string id, string contentRange, string sessionId, System.IO.Stream body, string contentDisposition = null, string xAdsRegion = null, string contentType = "application/octet-stream"); + + /// + /// + /// + /// + /// Resumable upload for signed URLs. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// Byte range of a segment being uploaded + /// Unique identifier of a session of a file being uploaded + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// ApiResponse of ObjectDetails + ApiResponse UploadSignedResourcesChunkWithHttpInfo (string id, string contentRange, string sessionId, System.IO.Stream body, string contentDisposition = null, string xAdsRegion = null, string contentType = "application/octet-stream"); + + #endregion Synchronous Operations + + #region Asynchronous Operations + /// + /// + /// + /// + /// Copies an object to another object name in the same bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// URL-encoded Object key to use as the destination + /// Task of ObjectDetails + System.Threading.Tasks.Task CopyToAsync (string bucketKey, string objectName, string newObjName); + + /// + /// + /// + /// + /// Copies an object to another object name in the same bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// URL-encoded Object key to use as the destination + /// Task of ApiResponse (ObjectDetails) + System.Threading.Tasks.Task> CopyToAsyncWithHttpInfo (string bucketKey, string objectName, string newObjName); + + /// + /// + /// + /// + /// This endpoint creates a signed URL that can be used to download an object within the specified expiration time. Be aware that if the object the signed URL points to is deleted or expires before the signed URL expires, then the signed URL will no longer be valid. A successful call to this endpoint requires bucket owner access. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Body Structure + /// Access for signed resource Acceptable values: `read`, `write`, `readwrite`. Default value: `read` (optional, default to read) + /// If true, this will generate a CloudFront URL for the S3 object + /// Task of PostObjectSigned + System.Threading.Tasks.Task CreateSignedResourceAsync (string bucketKey, string objectName, PostBucketsSigned postBucketsSigned, string access = null, bool useCdn = true); + + /// + /// + /// + /// + /// This endpoint creates a signed URL that can be used to download an object within the specified expiration time. Be aware that if the object the signed URL points to is deleted or expires before the signed URL expires, then the signed URL will no longer be valid. A successful call to this endpoint requires bucket owner access. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Body Structure + /// Access for signed resource Acceptable values: `read`, `write`, `readwrite`. Default value: `read` (optional, default to read) + /// If true, this will generate a CloudFront URL for the S3 object + /// Task of ApiResponse (PostObjectSigned) + System.Threading.Tasks.Task> CreateSignedResourceAsyncWithHttpInfo (string bucketKey, string objectName, PostBucketsSigned postBucketsSigned, string access = null, bool useCdn = true); + + /// + /// + /// + /// + /// Deletes an object from the bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Task of void + System.Threading.Tasks.Task DeleteObjectAsync (string bucketKey, string objectName); + + /// + /// + /// + /// + /// Deletes an object from the bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Task of ApiResponse + System.Threading.Tasks.Task> DeleteObjectAsyncWithHttpInfo (string bucketKey, string objectName); + + /// + /// + /// + /// + /// Delete a signed URL. A successful call to this endpoint requires bucket owner access. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Task of void + System.Threading.Tasks.Task DeleteSignedResourceAsync (string id, string region = null); + + /// + /// + /// + /// + /// Delete a signed URL. A successful call to this endpoint requires bucket owner access. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Task of ApiResponse + System.Threading.Tasks.Task> DeleteSignedResourceAsyncWithHttpInfo (string id, string region = null); + + /// + /// + /// + /// + /// Download an object. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// A range of bytes to download from the specified object. (optional) + /// The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. (optional) + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. (optional) + /// Task of System.IO.Stream + System.Threading.Tasks.Task GetObjectAsync (string bucketKey, string objectName, string range = null, string ifNoneMatch = null, DateTime? ifModifiedSince = null, string acceptEncoding = null); + + /// + /// + /// + /// + /// Download an object. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// A range of bytes to download from the specified object. (optional) + /// The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. (optional) + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. (optional) + /// Task of ApiResponse (System.IO.Stream) + System.Threading.Tasks.Task> GetObjectAsyncWithHttpInfo (string bucketKey, string objectName, string range = null, string ifNoneMatch = null, DateTime? ifModifiedSince = null, string acceptEncoding = null); + + /// + /// + /// + /// + /// Returns object details in JSON format. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// Extra information in details; multiple uses are supported Acceptable values: `createdDate`, `lastAccessedDate`, `lastModifiedDate` (optional) + /// Task of ObjectFullDetails + System.Threading.Tasks.Task GetObjectDetailsAsync (string bucketKey, string objectName, DateTime? ifModifiedSince = null, string with = null); + + /// + /// + /// + /// + /// Returns object details in JSON format. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// Extra information in details; multiple uses are supported Acceptable values: `createdDate`, `lastAccessedDate`, `lastModifiedDate` (optional) + /// Task of ApiResponse (ObjectFullDetails) + System.Threading.Tasks.Task> GetObjectDetailsAsyncWithHttpInfo (string bucketKey, string objectName, DateTime? ifModifiedSince = null, string with = null); + + /// + /// + /// + /// + /// List objects in a bucket. It is only available to the bucket creator. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// Limit to the response size, Acceptable values: 1-100 Default = 10 (optional, default to 10) + /// Provides a way to filter the based on object key name (optional) + /// Key to use as an offset to continue pagination This is typically the last bucket key found in a preceding GET buckets response (optional) + /// Task of BucketObjects + System.Threading.Tasks.Task GetObjectsAsync (string bucketKey, int? limit = null, string beginsWith = null, string startAt = null); + + /// + /// + /// + /// + /// List objects in a bucket. It is only available to the bucket creator. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// Limit to the response size, Acceptable values: 1-100 Default = 10 (optional, default to 10) + /// Provides a way to filter the based on object key name (optional) + /// Key to use as an offset to continue pagination This is typically the last bucket key found in a preceding GET buckets response (optional) + /// Task of ApiResponse (BucketObjects) + System.Threading.Tasks.Task> GetObjectsAsyncWithHttpInfo (string bucketKey, int? limit = null, string beginsWith = null, string startAt = null); + + /// + /// + /// + /// + /// Download an object using a signed URL. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// A range of bytes to download from the specified object. (optional) + /// The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. (optional) + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Task of System.IO.Stream + System.Threading.Tasks.Task GetSignedResourceAsync (string id, string range = null, string ifNoneMatch = null, DateTime? ifModifiedSince = null, string acceptEncoding = null, string region = null); + + /// + /// + /// + /// + /// Download an object using a signed URL. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// A range of bytes to download from the specified object. (optional) + /// The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. (optional) + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Task of ApiResponse (System.IO.Stream) + System.Threading.Tasks.Task> GetSignedResourceAsyncWithHttpInfo (string id, string range = null, string ifNoneMatch = null, DateTime? ifModifiedSince = null, string acceptEncoding = null, string region = null); + + /// + /// + /// + /// + /// This endpoint returns status information about a resumable upload. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Unique identifier of a session of a file being uploaded + /// Task of void + System.Threading.Tasks.Task GetStatusBySessionIdAsync (string bucketKey, string objectName, string sessionId); + + /// + /// + /// + /// + /// This endpoint returns status information about a resumable upload. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Unique identifier of a session of a file being uploaded + /// Task of ApiResponse + System.Threading.Tasks.Task> GetStatusBySessionIdAsyncWithHttpInfo (string bucketKey, string objectName, string sessionId); + + /// + /// + /// + /// + /// This endpoint allows resumable uploads for large files in chunks. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Indicates the size of the request body. + /// Byte range of a segment being uploaded + /// Unique identifier of a session of a file being uploaded + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// Task of ObjectDetails + System.Threading.Tasks.Task UploadChunkAsync (string bucketKey, string objectName, int? contentLength, string contentRange, string sessionId, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream"); + + /// + /// + /// + /// + /// This endpoint allows resumable uploads for large files in chunks. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Indicates the size of the request body. + /// Byte range of a segment being uploaded + /// Unique identifier of a session of a file being uploaded + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// Task of ApiResponse (ObjectDetails) + System.Threading.Tasks.Task> UploadChunkAsyncWithHttpInfo (string bucketKey, string objectName, int? contentLength, string contentRange, string sessionId, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream"); + + /// + /// + /// + /// + /// Upload an object. If the specified object name already exists in the bucket, the uploaded content will overwrite the existing content for the bucket name/object name combination. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Indicates the size of the request body. + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// Task of ObjectDetails + System.Threading.Tasks.Task UploadObjectAsync (string bucketKey, string objectName, int? contentLength, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream"); + + /// + /// + /// + /// + /// Upload an object. If the specified object name already exists in the bucket, the uploaded content will overwrite the existing content for the bucket name/object name combination. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Indicates the size of the request body. + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// Task of ApiResponse (ObjectDetails) + System.Threading.Tasks.Task> UploadObjectAsyncWithHttpInfo (string bucketKey, string objectName, int? contentLength, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream"); + + /// + /// + /// + /// + /// Overwrite a existing object using a signed URL. Conditions to call this operation: Object is available Expiration period is valid Signed URL should be created with `write` or `readwrite` + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// Indicates the size of the request body. + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// Task of ObjectDetails + System.Threading.Tasks.Task UploadSignedResourceAsync (string id, int? contentLength, System.IO.Stream body, string contentDisposition = null, string xAdsRegion = null, string ifMatch = null, string contentType = "application/octet-stream"); + + /// + /// + /// + /// + /// Overwrite a existing object using a signed URL. Conditions to call this operation: Object is available Expiration period is valid Signed URL should be created with `write` or `readwrite` + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// Indicates the size of the request body. + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// Task of ApiResponse (ObjectDetails) + System.Threading.Tasks.Task> UploadSignedResourceAsyncWithHttpInfo (string id, int? contentLength, System.IO.Stream body, string contentDisposition = null, string xAdsRegion = null, string ifMatch = null, string contentType = "application/octet-stream"); + + /// + /// + /// + /// + /// Resumable upload for signed URLs. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// Byte range of a segment being uploaded + /// Unique identifier of a session of a file being uploaded + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Task of ObjectDetails + System.Threading.Tasks.Task UploadSignedResourcesChunkAsync (string id, string contentRange, string sessionId, System.IO.Stream body, string contentDisposition = null, string xAdsRegion = null, string contentType = "application/octet-stream"); + + /// + /// + /// + /// + /// Resumable upload for signed URLs. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// Byte range of a segment being uploaded + /// Unique identifier of a session of a file being uploaded + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Task of ApiResponse (ObjectDetails) + System.Threading.Tasks.Task> UploadSignedResourcesChunkAsyncWithHttpInfo (string id, string contentRange, string sessionId, System.IO.Stream body, string contentDisposition = null, string xAdsRegion = null, string contentType = "application/octet-stream"); + + /// summary>Returns a signed S3 URL. + /// Thrown when fails to make API call + /// {String} bucket key (will be URL-encoded automatically) + /// {String} object key (will be URL-encoded automatically) + /// {Object=} Optional parameters + /// {String=} If the value of this header matches the ETag of the object, an entity will not be returned from the server; + /// instead a 304 (not modified) response will be returned without any message-body. + /// {Date=} If the requested object has not been modified since the time specified in this field, + /// an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message-body. + /// {String=} Value of the Content-Type header that the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {String=} Value of the Content Disposition header the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {String=} Value of the Cache-Control header that the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {Boolean=} Allows fallback to OSS signed URLs in case of unmerged resumable uploads. + /// {Boolean=true} Will generate a CloudFront URL for the S3 object. + /// {Integer=2} The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectKey-signeds3download-GET/ + /// Task of ApiResponse (ObjectS3Download) + System.Threading.Tasks.Task getS3DownloadURLAsync (string bucketKey, string objectKey, Dictionary opts = null); + + /// summary>Returns a signed S3 URL. + /// Thrown when fails to make API call + /// {String} bucket key (will be URL-encoded automatically) + /// {String} object key (will be URL-encoded automatically) + /// {Object=} Optional parameters + /// {String=} If the value of this header matches the ETag of the object, an entity will not be returned from the server; + /// instead a 304 (not modified) response will be returned without any message-body. + /// {Date=} If the requested object has not been modified since the time specified in this field, + /// an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message-body. + /// {String=} Value of the Content-Type header that the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {String=} Value of the Content Disposition header the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {String=} Value of the Cache-Control header that the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {Boolean=} Allows fallback to OSS signed URLs in case of unmerged resumable uploads. + /// {Boolean=true} Will generate a CloudFront URL for the S3 object. + /// {Integer=2} The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectKey-signeds3download-GET/ + /// Task of ApiResponse (ObjectS3Download) + System.Threading.Tasks.Task> getS3DownloadURLAsyncWithHttpInfo (string bucketKey, string objectKey, Dictionary opts = null); + + /// + /// Gets one or more signed URLs to objects. The signed URLs can be used to download the objects directly from S3, skipping OSS servers. + /// Be aware that expiration time for the signed URL(s) is just 60 seconds. So, a request to the URL(s) must begin within 60 seconds; the transfer + /// of the data can exceed 60 seconds. + /// A successful call to this endpoint requires bucket owner access. + /// Note that resumable uploads store each chunk individually. After upload completes, an async process merges all the chunks and creates the + /// definitive OSS file. This async process can take time. If you request an S3 download URL before the async process completes, the response returns + /// a map of S3 URLs, one per chunk where the key is the corresponding range bytes. In case you don't want multiple URLs in the response, you can use + /// OSS signed URL functionality , with the public-resource-fallback query parameter set to true. + /// Note: While this endpoint does not support range headers, the returned URL(s) can be used for ranged downloads. This way, downloads can be + /// parallelized using multiple ranges for maximum speed. + /// + /// {String} bucket key (will be URL-encoded automatically) + /// {Object} body parameter + /// {Object[]} An array of objects representing each request to get an S3 URL to download from. + /// {String} Object name to create a download S3 signed URL for + /// {String=} Value of the Content-Type header that the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {String=} Value of the Content Disposition header the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {String=} Value of the Cache-Control header that the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {String=} The value of this attribute is compared to the ETAG of the object. + /// If they match, the response body will show the status of this item as "skipped" with the reason as "Not modified". + /// {Date=} If the requested object has not been modified since the time specified in this attribute, + /// the response body will show the status of this item as "skipped" with the reason as "Not modified". + /// {Object=} Optional parameters + /// {Boolean=false } (public-resource-fallback) Allows fallback to OSS signed URLs in case of unmerged resumable uploads. + /// {Boolean=true} Will generate a CloudFront URL for the S3 object. + /// {Integer=2} The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-batchsigneds3download-POST/ + /// Task of ApiResponse (dynamic) + System.Threading.Tasks.Task getS3DownloadURLsAsync (string bucketKey, PostBatchSignedS3DownloadPayload body, Dictionary opts = null); + + /// + /// Gets one or more signed URLs to objects. The signed URLs can be used to download the objects directly from S3, skipping OSS servers. + /// Be aware that expiration time for the signed URL(s) is just 60 seconds. So, a request to the URL(s) must begin within 60 seconds; the transfer + /// of the data can exceed 60 seconds. + /// A successful call to this endpoint requires bucket owner access. + /// Note that resumable uploads store each chunk individually. After upload completes, an async process merges all the chunks and creates the + /// definitive OSS file. This async process can take time. If you request an S3 download URL before the async process completes, the response returns + /// a map of S3 URLs, one per chunk where the key is the corresponding range bytes. In case you don't want multiple URLs in the response, you can use + /// OSS signed URL functionality , with the public-resource-fallback query parameter set to true. + /// Note: While this endpoint does not support range headers, the returned URL(s) can be used for ranged downloads. This way, downloads can be + /// parallelized using multiple ranges for maximum speed. + /// + /// {String} bucket key (will be URL-encoded automatically) + /// {Object} body parameter + /// {Object[]} An array of objects representing each request to get an S3 URL to download from. + /// {String} Object name to create a download S3 signed URL for + /// {String=} Value of the Content-Type header that the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {String=} Value of the Content Disposition header the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {String=} Value of the Cache-Control header that the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {String=} The value of this attribute is compared to the ETAG of the object. + /// If they match, the response body will show the status of this item as "skipped" with the reason as "Not modified". + /// {Date=} If the requested object has not been modified since the time specified in this attribute, + /// the response body will show the status of this item as "skipped" with the reason as "Not modified". + /// {Object=} Optional parameters + /// {Boolean=false } (public-resource-fallback) Allows fallback to OSS signed URLs in case of unmerged resumable uploads. + /// {Boolean=true} Will generate a CloudFront URL for the S3 object. + /// {Integer=2} The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-batchsigneds3download-POST/ + /// Task of ApiResponse (dynamic) + System.Threading.Tasks.Task> getS3DownloadURLsAsyncWithHttpInfo (string bucketKey, PostBatchSignedS3DownloadPayload body, Dictionary opts = null); + + /// Requests an S3 signed URL with which to upload an object, or an array of signed URLs with which to upload an object in multiple parts. + /// {String} bucket key (will be URL-encoded automatically) + /// {String} object key (will be URL-encoded automatically) + /// {Object=} Optional parameters + /// {String=} Get a new set of signed urls if the ones that were generated before have already expired and the user + /// still needs to upload some of them. + /// {Integer=} For a multipart upload, is the starting index when getting upload part URL. + /// If this parameter is not specified the default value is firstPart = 1. + /// Example: To retrieve the parts from 10 to 15 you should pass firstPart = 10 and parts = 6, this will retrieve the parts 10, 11, 12, 13, 14 and 15. + /// {Integer=} For a multipart upload, is the starting index when getting upload part URL. + /// If this parameter is not specified the default value is firstPart = 1. + /// Example: To retrieve the parts from 10 to 15 you should pass firstPart = 10 and parts = 6, this will retrieve the parts 10, 11, 12, 13, 14 and 15. + /// + /// {Boolean=true} Whether or not to generate an accelerated signed URL (ie: URLs of + /// the form …s3-accelerate.amazonaws.com… vs …s3.amazonaws.com…). + /// When not specified, defaults to true. Providing non-boolean values will result in a 400 error. + /// {Integer=2} The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectKey-signeds3upload-GET/ + /// Task of ApiResponse (dynamic) + System.Threading.Tasks.Task getS3UploadURLAsync (string bucketKey, string objectKey, Dictionary opts = null); + + /// Requests an S3 signed URL with which to upload an object, or an array of signed URLs with which to upload an object in multiple parts. + /// {String} bucket key (will be URL-encoded automatically) + /// {String} object key (will be URL-encoded automatically) + /// {Object=} Optional parameters + /// {String=} Get a new set of signed urls if the ones that were generated before have already expired and the user + /// still needs to upload some of them. + /// {Integer=} For a multipart upload, is the starting index when getting upload part URL. + /// If this parameter is not specified the default value is firstPart = 1. + /// Example: To retrieve the parts from 10 to 15 you should pass firstPart = 10 and parts = 6, this will retrieve the parts 10, 11, 12, 13, 14 and 15. + /// {Integer=} For a multipart upload, is the starting index when getting upload part URL. + /// If this parameter is not specified the default value is firstPart = 1. + /// Example: To retrieve the parts from 10 to 15 you should pass firstPart = 10 and parts = 6, this will retrieve the parts 10, 11, 12, 13, 14 and 15. + /// + /// {Boolean=true} Whether or not to generate an accelerated signed URL (ie: URLs of + /// the form …s3-accelerate.amazonaws.com… vs …s3.amazonaws.com…). + /// When not specified, defaults to true. Providing non-boolean values will result in a 400 error. + /// {Integer=2} The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectKey-signeds3upload-GET/ + /// Task of ApiResponse (dynamic) + System.Threading.Tasks.Task> getS3UploadURLAsyncWithHttpInfo (string bucketKey, string objectKey, Dictionary opts = null); + + /// Instructs OSS to complete the object creation process after the bytes have been uploaded directly to S3. + /// {String} bucket key (will be URL-encoded automatically) + /// {String} object key (will be URL-encoded automatically) + /// {Object} + /// {String} The identifier of the upload session, which was provided by OSS in the response to the Get Upload URL/s request. + /// {Integer=} The expected size of the uploaded object. If provided, OSS will check this against the blob in S3 and return + /// an error if the size does not match. + /// {List=} An array of eTags. S3 returns an eTag to each upload request, be it for a chunk or an entire file. + /// For a single-part upload, this array contains the expected eTag of the entire object. For a multipart upload, this array contains the expected + /// eTag of each part of the upload; the index of an eTag in the array corresponds to its part number in the upload. If provided, OSS will validate + /// these eTags against the content in S3, and return an error if the eTags do not match (indicating some form of data corruption). + /// {Object=} Optional parameters + /// {String=} (x-ads-meta-Content-Type) The Content-Type value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Content-Disposition) The Content-Disposition value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Content-Encoding) The Content-Encoding value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Cache-Control) The Cache-Control value that OSS will store in the record for the uploaded object. + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectKey-signeds3upload-POST/ + /// Task of ApiResponse (dynamic) + System.Threading.Tasks.Task completeS3UploadAsync (string bucketKey, string objectKey, PostCompleteS3UploadPayload body, Dictionary opts = null); + + /// Instructs OSS to complete the object creation process after the bytes have been uploaded directly to S3. + /// {String} bucket key (will be URL-encoded automatically) + /// {String} object key (will be URL-encoded automatically) + /// {Object} + /// {String} The identifier of the upload session, which was provided by OSS in the response to the Get Upload URL/s request. + /// {Integer=} The expected size of the uploaded object. If provided, OSS will check this against the blob in S3 and return + /// an error if the size does not match. + /// {List=} An array of eTags. S3 returns an eTag to each upload request, be it for a chunk or an entire file. + /// For a single-part upload, this array contains the expected eTag of the entire object. For a multipart upload, this array contains the expected + /// eTag of each part of the upload; the index of an eTag in the array corresponds to its part number in the upload. If provided, OSS will validate + /// these eTags against the content in S3, and return an error if the eTags do not match (indicating some form of data corruption). + /// {Object=} Optional parameters + /// {String=} (x-ads-meta-Content-Type) The Content-Type value that OSS will store in the record for the uploaded obcreateject. + /// {String=} (x-ads-meta-Content-Disposition) The Content-Disposition value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Content-Encoding) The Content-Encoding value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Cache-Control) The Cache-Control value that OSS will store in the record for the uploaded object. + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectKey-signeds3upload-POST/ + /// Task of ApiResponse (dynamic) + System.Threading.Tasks.Task> completeS3UploadAsyncWithHttpInfo (string bucketKey, string objectKey, PostCompleteS3UploadPayload body, Dictionary opts = null); + + /// Instructs OSS to complete the object creation process for numerous objects after their bytes have been uploaded directly to S3. + /// {String} bucket key (will be URL-encoded automatically) + /// {Object} body parameter + /// {Object[]} An array of objects representing each request to get an S3 URL to download from. + /// {String} The key/name of the object for which to complete an upload. + /// {String} The identifier of the upload session, which was provided by OSS in the response to the Get Upload URL/s request. + /// {Integer=} The expected size of the uploaded object. If provided, OSS will check this against the blob in S3 and return + /// an error if the size does not match. + /// {String[]=} An array of eTags. S3 returns an eTag to each upload request, be it for a chunk or an entire file. + /// For a single-part upload, this array contains the expected eTag of the entire object. For a multipart upload, this array contains the expected + /// eTag of each part of the upload; the index of an eTag in the array corresponds to its part number in the upload. If provided, OSS will validate + /// these eTags against the content in S3, and return an error if the eTags do not match (indicating some form of data corruption). + /// {String=} (x-ads-meta-Content-Type) The Content-Type value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Content-Disposition) The Content-Disposition value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Content-Encoding) The Content-Encoding value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Cache-Control) The Cache-Control value that OSS will store in the record for the uploaded object. + /// {Object=} Optional parameters + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectKey-batchcompleteupload-POST/ + /// Task of ApiResponse (dynamic) + System.Threading.Tasks.Task completeS3UploadsAsync (string bucketKey, PostBatchCompleteS3UploadPayload body, Dictionary opts = null); + + /// Instructs OSS to complete the object creation process for numerous objects after their bytes have been uploaded directly to S3. + /// {String} bucket key (will be URL-encoded automatically) + /// {Object} body parameter + /// {Object[]} An array of objects representing each request to get an S3 URL to download from. + /// {String} The key/name of the object for which to complete an upload. + /// {String} The identifier of the upload session, which was provided by OSS in the response to the Get Upload URL/s request. + /// {Integer=} The expected size of the uploaded object. If provided, OSS will check this against the blob in S3 and return + /// an error if the size does not match. + /// {String[]=} An array of eTags. S3 returns an eTag to each upload request, be it for a chunk or an entire file. + /// For a single-part upload, this array contains the expected eTag of the entire object. For a multipart upload, this array contains the expected + /// eTag of each part of the upload; the index of an eTag in the array corresponds to its part number in the upload. If provided, OSS will validate + /// these eTags against the content in S3, and return an error if the eTags do not match (indicating some form of data corruption). + /// {String=} (x-ads-meta-Content-Type) The Content-Type value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Content-Disposition) The Content-Disposition value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Content-Encoding) The Content-Encoding value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Cache-Control) The Cache-Control value that OSS will store in the record for the uploaded object. + /// {Object=} Optional parameters + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectKey-batchcompleteupload-POST/ + /// Task of ApiResponse (dynamic) + System.Threading.Tasks.Task> completeS3UploadsAsyncWithHttpInfo (string bucketKey, PostBatchCompleteS3UploadPayload body, Dictionary opts = null); + + /// Requests a batch of S3 signed URL with which to upload multiple objects or chunks of multiple objects. + /// {String} bucket key (will be URL-encoded automatically) + /// {Object} body parameter + /// {Object[]} An array of objects representing each request to get an S3 URL to download from. + /// {String} The key/name of the object for which to create an S3 upload URL. If neither the "part" nor "parts" + /// attribute is provided, OSS will return a single upload URL with which to upload the entire object. + /// {String=} Get a new set of signed urls if the ones that were generated before have already expired and the user + /// still needs to upload some of them. + /// {Integer=} For a multipart upload, is the starting index when getting upload part URL. + /// If this parameter is not specified the default value is firstPart = 1. + /// Example: To retrieve the parts from 10 to 15 you should pass firstPart = 10 and parts = 6, this will retrieve the parts 10, 11, 12, 13, 14 and 15. + /// @param {Integer=} [body.requests[].parts=1] For a multipart upload, is the starting index when getting upload part URL. + /// If this parameter is not specified the default value is firstPart = 1. + /// Example: To retrieve the parts from 10 to 15 you should pass firstPart = 10 and parts = 6, this will retrieve the parts 10, 11, 12, 13, 14 and 15. + /// {Object=} Optional parameters + /// {Boolean=true} Whether or not to generate an accelerated signed URL (ie: URLs of + /// the form …s3-accelerate.amazonaws.com… vs …s3.amazonaws.com…). + /// When not specified, defaults to true. Providing non-boolean values will result in a 400 error. + /// {Integer=2} The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectKey-batchsigneds3upload-POST/ + /// Task of ApiResponse (dynamic) + System.Threading.Tasks.Task getS3UploadURLsAsync (string bucketKey, PostBatchSignedS3UploadPayload body, Dictionary opts = null); + + /// Requests a batch of S3 signed URL with which to upload multiple objects or chunks of multiple objects. + /// {String} bucket key (will be URL-encoded automatically) + /// {Object} body parameter + /// {Object[]} An array of objects representing each request to get an S3 URL to download from. + /// {String} The key/name of the object for which to create an S3 upload URL. If neither the "part" nor "parts" + /// attribute is provided, OSS will return a single upload URL with which to upload the entire object. + /// {String=} Get a new set of signed urls if the ones that were generated before have already expired and the user + /// still needs to upload some of them. + /// {Integer=} For a multipart upload, is the starting index when getting upload part URL. + /// If this parameter is not specified the default value is firstPart = 1. + /// Example: To retrieve the parts from 10 to 15 you should pass firstPart = 10 and parts = 6, this will retrieve the parts 10, 11, 12, 13, 14 and 15. + /// @param {Integer=} [body.requests[].parts=1] For a multipart upload, is the starting index when getting upload part URL. + /// If this parameter is not specified the default value is firstPart = 1. + /// Example: To retrieve the parts from 10 to 15 you should pass firstPart = 10 and parts = 6, this will retrieve the parts 10, 11, 12, 13, 14 and 15. + /// {Object=} Optional parameters + /// {Boolean=true} Whether or not to generate an accelerated signed URL (ie: URLs of + /// the form …s3-accelerate.amazonaws.com… vs …s3.amazonaws.com…). + /// When not specified, defaults to true. Providing non-boolean values will result in a 400 error. + /// {Integer=2} The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectKey-batchsigneds3upload-POST/ + /// Task of ApiResponse (dynamic) + System.Threading.Tasks.Task> getS3UploadURLsAsyncWithHttpInfo (string bucketKey, PostBatchSignedS3UploadPayload body, Dictionary opts = null); + + // Workflow implementations + + /// Download a resource. + /// {String} bucket key (will be URL-encoded automatically) + /// {Object|Object[]} Object or Object array of resource to uplaod with their parameters + /// {String} object key + /// {String} Resource to upload + /// If String, it is the expected response type (defaults to json) ['arraybuffer', 'document', 'json', 'text', 'stream'] + /// If you 'stream', you need to provide a writable stream ('data'), the method will pipe content into it. + /// {Object=} Optional parameters + /// {Boolean=false} Allows fallback to OSS signed URLs in case of unmerged resumable uploads. + /// {Boolean=true} Will generate a CloudFront URL for the S3 object. + /// {Integer=2} The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. + /// {Integer=0} Chunk size in Mb. Should not be below 5Mb. Default is 0, download file in one piece. + /// {DownloadItemsCallBack} (progressEvent) => {} + /// {RefreshTokenCallBack} () => {} + /// Task of ApiResponse (dynamic[]) + System.Threading.Tasks.Task> downloadResources (string bucketKey, List objects, Dictionary opts = null, DownloadItemsCallBack onDownloadProgress = null, RefreshTokenCallBack onRefreshToken = null); + + /// Upload a resource. If the specified object name already exists in the bucket, the uploaded content will overwrite the existing content for the bucket name/object name combination. + /// {String} bucket key (will be URL-encoded automatically) + /// {Object|Object[]} Object or Object array of resource to upload with their parameters + /// {String} object key + /// {String|Buffer|Stream} Resource to upload (String| Buffer | Stream) + /// {String[]=} An array of eTags. S3 returns an eTag to each upload request, be it for a chunk or an entire file. + /// For a single-part upload, this array contains the expected eTag of the entire object. For a multipart upload, this array contains the expected + /// eTag of each part of the upload; the index of an eTag in the array corresponds to its part number in the upload. If provided, OSS will validate + /// these eTags against the content in S3, and return an error if the eTags do not match (indicating some form of data corruption). + /// {String=} (x-ads-meta-Content-Type) The Content-Type value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Content-Disposition) The Content-Disposition value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Content-Encoding) The Content-Encoding value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Cache-Control) The Cache-Control value that OSS will store in the record for the uploaded object. + /// {Object=} Optional parameters + /// {Integer=5} Chunk size in Mb. Should not be below 5Mb. + /// {Integer=25} Maximum batch to produces. Should not be above 25 or below 1. + /// {Boolean=true} Whether or not to generate an accelerated signed URL (ie: URLs of + /// the form …s3-accelerate.amazonaws.com… vs …s3.amazonaws.com…). + /// When not specified, defaults to true. Providing non-boolean values will result in a 400 error. + /// {Integer=2} The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. + /// {DownloadItemsCallBack} (progressEvent) => {} + /// {RefreshTokenCallBack} () => {} + /// Task of ApiResponse (dynamic[]) + System.Threading.Tasks.Task> uploadResources (string bucketKey, List objects, Dictionary opts = null, UploadItemsCallBack onUploadProgress = null, RefreshTokenCallBack onRefreshToken = null); + + // Workflow implementations + + #endregion Asynchronous Operations + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class ObjectsApi : IObjectsApi { + + private Autodesk.Forge.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public ObjectsApi (String basePath) { + this.Configuration = new Configuration (new ApiClient (basePath)); + + ExceptionFactory = Autodesk.Forge.Client.Configuration.DefaultExceptionFactory; + + // ensure API client has configuration ready + if ( Configuration.ApiClient.Configuration == null ) { + this.Configuration.ApiClient.Configuration = this.Configuration; + } + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public ObjectsApi (Configuration configuration = null) { + if ( configuration == null ) // use the default one in Configuration + this.Configuration = Configuration.Default; + else + this.Configuration = configuration; + + ExceptionFactory = Autodesk.Forge.Client.Configuration.DefaultExceptionFactory; + + // ensure API client has configuration ready + if ( Configuration.ApiClient.Configuration == null ) { + this.Configuration.ApiClient.Configuration = this.Configuration; + } + } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath () { + return this.Configuration.ApiClient.RestClient.Options.BaseUrl.ToString (); + } + + /// + /// Sets the base path of the API client. + /// + /// The base path + [Obsolete ("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")] + public void SetBasePath (String basePath) { + // do nothing + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Configuration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Autodesk.Forge.Client.ExceptionFactory ExceptionFactory { + get { + if ( _exceptionFactory != null && _exceptionFactory.GetInvocationList ().Length > 1 ) { + throw new InvalidOperationException ("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Gets the default header. + /// + /// Dictionary of HTTP header + [Obsolete ("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] + public Dictionary DefaultHeader () { + return this.Configuration.DefaultHeader; + } + + /// + /// Add default header. + /// + /// Header field name. + /// Header field value. + /// + [Obsolete ("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")] + public void AddDefaultHeader (string key, string value) { + this.Configuration.AddDefaultHeader (key, value); + } + + /// + /// Copies an object to another object name in the same bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// URL-encoded Object key to use as the destination + /// ObjectDetails + public /*ObjectDetails*/dynamic CopyTo (string bucketKey, string objectName, string newObjName) { + ApiResponse localVarResponse = CopyToWithHttpInfo (bucketKey, objectName, newObjName); + return localVarResponse.Data; + } + + /// + /// Copies an object to another object name in the same bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// URL-encoded Object key to use as the destination + /// ApiResponse of ObjectDetails + public ApiResponse< /*ObjectDetails*/dynamic> CopyToWithHttpInfo (string bucketKey, string objectName, string newObjName) { + // verify the required parameter 'bucketKey' is set + if ( bucketKey == null ) + throw new ApiException (400, "Missing required parameter 'bucketKey' when calling ObjectsApi->CopyTo"); + // verify the required parameter 'objectName' is set + if ( objectName == null ) + throw new ApiException (400, "Missing required parameter 'objectName' when calling ObjectsApi->CopyTo"); + // verify the required parameter 'newObjName' is set + if ( newObjName == null ) + throw new ApiException (400, "Missing required parameter 'newObjName' when calling ObjectsApi->CopyTo"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects/{objectName}/copyto/{newObjName}"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( bucketKey != null ) + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + if ( objectName != null ) + localVarPathParams.Add ("objectName", Configuration.ApiClient.ParameterToString (objectName)); // path parameter + if ( newObjName != null ) + localVarPathParams.Add ("newObjName", Configuration.ApiClient.ParameterToString (newObjName)); // path parameter + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)Configuration.ApiClient.CallApi (localVarPath, + Method.Put, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("CopyTo", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(ObjectDetails)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (ObjectDetails))); + + } + + /// + /// Copies an object to another object name in the same bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// URL-encoded Object key to use as the destination + /// Task of ObjectDetails + public async System.Threading.Tasks.Task CopyToAsync (string bucketKey, string objectName, string newObjName) { + ApiResponse localVarResponse = await CopyToAsyncWithHttpInfo (bucketKey, objectName, newObjName); + return localVarResponse.Data; + + } + + /// + /// Copies an object to another object name in the same bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// URL-encoded Object key to use as the destination + /// Task of ApiResponse (ObjectDetails) + public async System.Threading.Tasks.Task> CopyToAsyncWithHttpInfo (string bucketKey, string objectName, string newObjName) { + // verify the required parameter 'bucketKey' is set + if ( bucketKey == null ) + throw new ApiException (400, "Missing required parameter 'bucketKey' when calling ObjectsApi->CopyTo"); + // verify the required parameter 'objectName' is set + if ( objectName == null ) + throw new ApiException (400, "Missing required parameter 'objectName' when calling ObjectsApi->CopyTo"); + // verify the required parameter 'newObjName' is set + if ( newObjName == null ) + throw new ApiException (400, "Missing required parameter 'newObjName' when calling ObjectsApi->CopyTo"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects/{objectName}/copyto/{newObjName}"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( bucketKey != null ) + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + if ( objectName != null ) + localVarPathParams.Add ("objectName", Configuration.ApiClient.ParameterToString (objectName)); // path parameter + if ( newObjName != null ) + localVarPathParams.Add ("newObjName", Configuration.ApiClient.ParameterToString (newObjName)); // path parameter + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync (localVarPath, + Method.Put, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("CopyTo", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(ObjectDetails)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (ObjectDetails))); + + } + + /// + /// This endpoint creates a signed URL that can be used to download an object within the specified expiration time. Be aware that if the object the signed URL points to is deleted or expires before the signed URL expires, then the signed URL will no longer be valid. A successful call to this endpoint requires bucket owner access. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Body Structure + /// Access for signed resource Acceptable values: `read`, `write`, `readwrite`. Default value: `read` (optional, default to read) + /// If true, this will generate a CloudFront URL for the S3 object + /// PostObjectSigned + public /*PostObjectSigned*/dynamic CreateSignedResource (string bucketKey, string objectName, PostBucketsSigned postBucketsSigned, string access = null, bool useCdn = true) { + ApiResponse localVarResponse = CreateSignedResourceWithHttpInfo (bucketKey, objectName, postBucketsSigned, access, useCdn); + return (localVarResponse.Data); + } + + /// + /// This endpoint creates a signed URL that can be used to download an object within the specified expiration time. Be aware that if the object the signed URL points to is deleted or expires before the signed URL expires, then the signed URL will no longer be valid. A successful call to this endpoint requires bucket owner access. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Body Structure + /// Access for signed resource Acceptable values: `read`, `write`, `readwrite`. Default value: `read` (optional, default to read) + /// If true, this will generate a CloudFront URL for the S3 object + /// ApiResponse of PostObjectSigned + public ApiResponse< /*PostObjectSigned*/dynamic> CreateSignedResourceWithHttpInfo (string bucketKey, string objectName, PostBucketsSigned postBucketsSigned, string access = null, bool useCdn = true) { + // verify the required parameter 'bucketKey' is set + if ( bucketKey == null ) + throw new ApiException (400, "Missing required parameter 'bucketKey' when calling ObjectsApi->CreateSignedResource"); + // verify the required parameter 'objectName' is set + if ( objectName == null ) + throw new ApiException (400, "Missing required parameter 'objectName' when calling ObjectsApi->CreateSignedResource"); + // verify the required parameter 'postBucketsSigned' is set + if ( postBucketsSigned == null ) + throw new ApiException (400, "Missing required parameter 'postBucketsSigned' when calling ObjectsApi->CreateSignedResource"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects/{objectName}/signed"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( bucketKey != null ) + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + if ( objectName != null ) + localVarPathParams.Add ("objectName", Configuration.ApiClient.ParameterToString (objectName)); // path parameter + if ( access != null ) + localVarQueryParams.Add ("access", Configuration.ApiClient.ParameterToString (access)); // query parameter + localVarQueryParams.Add ("useCdn", Configuration.ApiClient.ParameterToString (useCdn)); + if ( postBucketsSigned != null && postBucketsSigned.GetType () == typeof (byte []) ) // http body (model) parameter + { + localVarPostBody = postBucketsSigned; // byte array + } else if ( postBucketsSigned != null + && (postBucketsSigned.GetType () == typeof (System.IO.FileStream) + || postBucketsSigned.GetType () == typeof (System.IO.BinaryReader) + || postBucketsSigned.GetType () == typeof (System.IO.BufferedStream) + || postBucketsSigned.GetType () == typeof (System.IO.MemoryStream) + || postBucketsSigned.GetType () == typeof (System.IO.StreamReader) + ) + ) { + localVarPostBody = Configuration.ApiClient.toByteArray (postBucketsSigned); // byte array + } else if ( postBucketsSigned != null ) { + localVarPostBody = Configuration.ApiClient.Serialize (postBucketsSigned); + } + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)Configuration.ApiClient.CallApi (localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("CreateSignedResource", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(PostObjectSigned)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (PostObjectSigned))); + + } + + /// + /// This endpoint creates a signed URL that can be used to download an object within the specified expiration time. Be aware that if the object the signed URL points to is deleted or expires before the signed URL expires, then the signed URL will no longer be valid. A successful call to this endpoint requires bucket owner access. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Body Structure + /// Access for signed resource Acceptable values: `read`, `write`, `readwrite`. Default value: `read` (optional, default to read) + /// If true, this will generate a CloudFront URL for the S3 object + /// Task of PostObjectSigned + public async System.Threading.Tasks.Task CreateSignedResourceAsync (string bucketKey, string objectName, PostBucketsSigned postBucketsSigned, string access = null, bool useCdn = true) { + ApiResponse localVarResponse = await CreateSignedResourceAsyncWithHttpInfo (bucketKey, objectName, postBucketsSigned, access, useCdn); + return (localVarResponse.Data); + } + + /// + /// This endpoint creates a signed URL that can be used to download an object within the specified expiration time. Be aware that if the object the signed URL points to is deleted or expires before the signed URL expires, then the signed URL will no longer be valid. A successful call to this endpoint requires bucket owner access. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Body Structure + /// Access for signed resource Acceptable values: `read`, `write`, `readwrite`. Default value: `read` (optional, default to read) + /// If true, this will generate a CloudFront URL for the S3 object + /// Task of ApiResponse (PostObjectSigned) + public async System.Threading.Tasks.Task> CreateSignedResourceAsyncWithHttpInfo (string bucketKey, string objectName, PostBucketsSigned postBucketsSigned, string access = null, bool useCdn = true) { + // verify the required parameter 'bucketKey' is set + if ( bucketKey == null ) + throw new ApiException (400, "Missing required parameter 'bucketKey' when calling ObjectsApi->CreateSignedResource"); + // verify the required parameter 'objectName' is set + if ( objectName == null ) + throw new ApiException (400, "Missing required parameter 'objectName' when calling ObjectsApi->CreateSignedResource"); + // verify the required parameter 'postBucketsSigned' is set + if ( postBucketsSigned == null ) + throw new ApiException (400, "Missing required parameter 'postBucketsSigned' when calling ObjectsApi->CreateSignedResource"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects/{objectName}/signed"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( bucketKey != null ) + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + if ( objectName != null ) + localVarPathParams.Add ("objectName", Configuration.ApiClient.ParameterToString (objectName)); // path parameter + if ( access != null ) + localVarQueryParams.Add ("access", Configuration.ApiClient.ParameterToString (access)); // query parameter + localVarQueryParams.Add ("useCdn", Configuration.ApiClient.ParameterToString (useCdn)); + if ( postBucketsSigned != null && postBucketsSigned.GetType () == typeof (byte []) ) // http body (model) parameter + { + localVarPostBody = postBucketsSigned; // byte array + } else if ( postBucketsSigned != null + && (postBucketsSigned.GetType () == typeof (System.IO.FileStream) + || postBucketsSigned.GetType () == typeof (System.IO.BinaryReader) + || postBucketsSigned.GetType () == typeof (System.IO.BufferedStream) + || postBucketsSigned.GetType () == typeof (System.IO.MemoryStream) + || postBucketsSigned.GetType () == typeof (System.IO.StreamReader) + ) + ) { + localVarPostBody = Configuration.ApiClient.toByteArray (postBucketsSigned); // byte array + } else if ( postBucketsSigned != null ) { + localVarPostBody = Configuration.ApiClient.Serialize (postBucketsSigned); + } + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync (localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("CreateSignedResource", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(PostObjectSigned)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (PostObjectSigned))); + + } + + /// + /// Deletes an object from the bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// + public void DeleteObject (string bucketKey, string objectName) { + DeleteObjectWithHttpInfo (bucketKey, objectName); + } + + /// + /// Deletes an object from the bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// ApiResponse of Object(void) + public ApiResponse DeleteObjectWithHttpInfo (string bucketKey, string objectName) { + // verify the required parameter 'bucketKey' is set + if ( bucketKey == null ) + throw new ApiException (400, "Missing required parameter 'bucketKey' when calling ObjectsApi->DeleteObject"); + // verify the required parameter 'objectName' is set + if ( objectName == null ) + throw new ApiException (400, "Missing required parameter 'objectName' when calling ObjectsApi->DeleteObject"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects/{objectName}"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( bucketKey != null ) + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + if ( objectName != null ) + localVarPathParams.Add ("objectName", Configuration.ApiClient.ParameterToString (objectName)); // path parameter + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)Configuration.ApiClient.CallApi (localVarPath, + Method.Delete, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("DeleteObject", localVarResponse); + if ( exception != null ) + throw exception; + } + + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + null); + } + + /// + /// Deletes an object from the bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Task of void + public async System.Threading.Tasks.Task DeleteObjectAsync (string bucketKey, string objectName) { + await DeleteObjectAsyncWithHttpInfo (bucketKey, objectName); + + } + + /// + /// Deletes an object from the bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Task of ApiResponse + public async System.Threading.Tasks.Task> DeleteObjectAsyncWithHttpInfo (string bucketKey, string objectName) { + // verify the required parameter 'bucketKey' is set + if ( bucketKey == null ) + throw new ApiException (400, "Missing required parameter 'bucketKey' when calling ObjectsApi->DeleteObject"); + // verify the required parameter 'objectName' is set + if ( objectName == null ) + throw new ApiException (400, "Missing required parameter 'objectName' when calling ObjectsApi->DeleteObject"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects/{objectName}"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( bucketKey != null ) + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + if ( objectName != null ) + localVarPathParams.Add ("objectName", Configuration.ApiClient.ParameterToString (objectName)); // path parameter + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync (localVarPath, + Method.Delete, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("DeleteObject", localVarResponse); + if ( exception != null ) + throw exception; + } + + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + null); + } + + /// + /// Delete a signed URL. A successful call to this endpoint requires bucket owner access. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// + public void DeleteSignedResource (string id, string region = null) { + DeleteSignedResourceWithHttpInfo (id, region); + } + + /// + /// Delete a signed URL. A successful call to this endpoint requires bucket owner access. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// ApiResponse of Object(void) + public ApiResponse DeleteSignedResourceWithHttpInfo (string id, string region = null) { + // verify the required parameter 'id' is set + if ( id == null ) + throw new ApiException (400, "Missing required parameter 'id' when calling ObjectsApi->DeleteSignedResource"); + + var localVarPath = "/oss/v2/signedresources/{id}"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "text/plain" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( id != null ) + localVarPathParams.Add ("id", Configuration.ApiClient.ParameterToString (id)); // path parameter + if ( region != null ) + localVarQueryParams.Add ("region", Configuration.ApiClient.ParameterToString (region)); // query parameter + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)Configuration.ApiClient.CallApi (localVarPath, + Method.Delete, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("DeleteSignedResource", localVarResponse); + if ( exception != null ) + throw exception; + } + + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + null); + } + + /// + /// Delete a signed URL. A successful call to this endpoint requires bucket owner access. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Task of void + public async System.Threading.Tasks.Task DeleteSignedResourceAsync (string id, string region = null) { + await DeleteSignedResourceAsyncWithHttpInfo (id, region); + + } + + /// + /// Delete a signed URL. A successful call to this endpoint requires bucket owner access. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Task of ApiResponse + public async System.Threading.Tasks.Task> DeleteSignedResourceAsyncWithHttpInfo (string id, string region = null) { + // verify the required parameter 'id' is set + if ( id == null ) + throw new ApiException (400, "Missing required parameter 'id' when calling ObjectsApi->DeleteSignedResource"); + + var localVarPath = "/oss/v2/signedresources/{id}"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "text/plain" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( id != null ) + localVarPathParams.Add ("id", Configuration.ApiClient.ParameterToString (id)); // path parameter + if ( region != null ) + localVarQueryParams.Add ("region", Configuration.ApiClient.ParameterToString (region)); // query parameter + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync (localVarPath, + Method.Delete, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("DeleteSignedResource", localVarResponse); + if ( exception != null ) + throw exception; + } + + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + null); + } + + /// + /// Download an object. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// A range of bytes to download from the specified object. (optional) + /// The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. (optional) + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. (optional) + /// System.IO.Stream + public /*System.IO.Stream*/dynamic GetObject (string bucketKey, string objectName, string range = null, string ifNoneMatch = null, DateTime? ifModifiedSince = null, string acceptEncoding = null) { + ApiResponse localVarResponse = GetObjectWithHttpInfo (bucketKey, objectName, range, ifNoneMatch, ifModifiedSince, acceptEncoding); + return localVarResponse.Data; + } + + /// + /// Download an object. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// A range of bytes to download from the specified object. (optional) + /// The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. (optional) + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. (optional) + /// ApiResponse of System.IO.Stream + public ApiResponse< /*System.IO.Stream*/dynamic> GetObjectWithHttpInfo (string bucketKey, string objectName, string range = null, string ifNoneMatch = null, DateTime? ifModifiedSince = null, string acceptEncoding = null) { + // verify the required parameter 'bucketKey' is set + if ( bucketKey == null ) + throw new ApiException (400, "Missing required parameter 'bucketKey' when calling ObjectsApi->GetObject"); + // verify the required parameter 'objectName' is set + if ( objectName == null ) + throw new ApiException (400, "Missing required parameter 'objectName' when calling ObjectsApi->GetObject"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects/{objectName}"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/octet-stream" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( bucketKey != null ) + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + if ( objectName != null ) + localVarPathParams.Add ("objectName", Configuration.ApiClient.ParameterToString (objectName)); // path parameter + if ( range != null ) + localVarHeaderParams.Add ("Range", Configuration.ApiClient.ParameterToString (range)); // header parameter + if ( ifNoneMatch != null ) + localVarHeaderParams.Add ("If-None-Match", Configuration.ApiClient.ParameterToString (ifNoneMatch)); // header parameter + if ( ifModifiedSince != null ) + localVarHeaderParams.Add ("If-Modified-Since", Configuration.ApiClient.ParameterToString (ifModifiedSince)); // header parameter + if ( acceptEncoding != null ) + localVarHeaderParams.Add ("Accept-Encoding", Configuration.ApiClient.ParameterToString (acceptEncoding)); // header parameter + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)Configuration.ApiClient.CallApi (localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("GetObject", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(System.IO.Stream)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (System.IO.Stream))); + + } + + /// + /// Download an object. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// A range of bytes to download from the specified object. (optional) + /// The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. (optional) + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. (optional) + /// Task of System.IO.Stream + public async System.Threading.Tasks.Task GetObjectAsync (string bucketKey, string objectName, string range = null, string ifNoneMatch = null, DateTime? ifModifiedSince = null, string acceptEncoding = null) { + ApiResponse localVarResponse = await GetObjectAsyncWithHttpInfo (bucketKey, objectName, range, ifNoneMatch, ifModifiedSince, acceptEncoding); + return localVarResponse.Data; + + } + + /// + /// Download an object. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// A range of bytes to download from the specified object. (optional) + /// The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. (optional) + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. (optional) + /// Task of ApiResponse (System.IO.Stream) + public async System.Threading.Tasks.Task> GetObjectAsyncWithHttpInfo (string bucketKey, string objectName, string range = null, string ifNoneMatch = null, DateTime? ifModifiedSince = null, string acceptEncoding = null) { + // verify the required parameter 'bucketKey' is set + if ( bucketKey == null ) + throw new ApiException (400, "Missing required parameter 'bucketKey' when calling ObjectsApi->GetObject"); + // verify the required parameter 'objectName' is set + if ( objectName == null ) + throw new ApiException (400, "Missing required parameter 'objectName' when calling ObjectsApi->GetObject"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects/{objectName}"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/octet-stream" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( bucketKey != null ) + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + if ( objectName != null ) + localVarPathParams.Add ("objectName", Configuration.ApiClient.ParameterToString (objectName)); // path parameter + if ( range != null ) + localVarHeaderParams.Add ("Range", Configuration.ApiClient.ParameterToString (range)); // header parameter + if ( ifNoneMatch != null ) + localVarHeaderParams.Add ("If-None-Match", Configuration.ApiClient.ParameterToString (ifNoneMatch)); // header parameter + if ( ifModifiedSince != null ) + localVarHeaderParams.Add ("If-Modified-Since", Configuration.ApiClient.ParameterToString (ifModifiedSince)); // header parameter + if ( acceptEncoding != null ) + localVarHeaderParams.Add ("Accept-Encoding", Configuration.ApiClient.ParameterToString (acceptEncoding)); // header parameter + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync (localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("GetObject", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(System.IO.Stream)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (System.IO.Stream))); + + } + + /// + /// Returns object details in JSON format. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// Extra information in details; multiple uses are supported Acceptable values: `createdDate`, `lastAccessedDate`, `lastModifiedDate` (optional) + /// ObjectFullDetails + public /*ObjectFullDetails*/dynamic GetObjectDetails (string bucketKey, string objectName, DateTime? ifModifiedSince = null, string with = null) { + ApiResponse localVarResponse = GetObjectDetailsWithHttpInfo (bucketKey, objectName, ifModifiedSince, with); + return localVarResponse.Data; + } + + /// + /// Returns object details in JSON format. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// Extra information in details; multiple uses are supported Acceptable values: `createdDate`, `lastAccessedDate`, `lastModifiedDate` (optional) + /// ApiResponse of ObjectFullDetails + public ApiResponse< /*ObjectFullDetails*/dynamic> GetObjectDetailsWithHttpInfo (string bucketKey, string objectName, DateTime? ifModifiedSince = null, string with = null) { + // verify the required parameter 'bucketKey' is set + if ( bucketKey == null ) + throw new ApiException (400, "Missing required parameter 'bucketKey' when calling ObjectsApi->GetObjectDetails"); + // verify the required parameter 'objectName' is set + if ( objectName == null ) + throw new ApiException (400, "Missing required parameter 'objectName' when calling ObjectsApi->GetObjectDetails"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects/{objectName}/details"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( bucketKey != null ) + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + if ( objectName != null ) + localVarPathParams.Add ("objectName", Configuration.ApiClient.ParameterToString (objectName)); // path parameter + if ( with != null ) + localVarQueryParams.Add ("with", Configuration.ApiClient.ParameterToString (with)); // query parameter + if ( ifModifiedSince != null ) + localVarHeaderParams.Add ("If-Modified-Since", Configuration.ApiClient.ParameterToString (ifModifiedSince)); // header parameter + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)Configuration.ApiClient.CallApi (localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("GetObjectDetails", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(ObjectFullDetails)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (ObjectFullDetails))); + + } + + /// + /// Returns object details in JSON format. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// Extra information in details; multiple uses are supported Acceptable values: `createdDate`, `lastAccessedDate`, `lastModifiedDate` (optional) + /// Task of ObjectFullDetails + public async System.Threading.Tasks.Task GetObjectDetailsAsync (string bucketKey, string objectName, DateTime? ifModifiedSince = null, string with = null) { + ApiResponse localVarResponse = await GetObjectDetailsAsyncWithHttpInfo (bucketKey, objectName, ifModifiedSince, with); + return localVarResponse.Data; + + } + + /// + /// Returns object details in JSON format. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// Extra information in details; multiple uses are supported Acceptable values: `createdDate`, `lastAccessedDate`, `lastModifiedDate` (optional) + /// Task of ApiResponse (ObjectFullDetails) + public async System.Threading.Tasks.Task> GetObjectDetailsAsyncWithHttpInfo (string bucketKey, string objectName, DateTime? ifModifiedSince = null, string with = null) { + // verify the required parameter 'bucketKey' is set + if ( bucketKey == null ) + throw new ApiException (400, "Missing required parameter 'bucketKey' when calling ObjectsApi->GetObjectDetails"); + // verify the required parameter 'objectName' is set + if ( objectName == null ) + throw new ApiException (400, "Missing required parameter 'objectName' when calling ObjectsApi->GetObjectDetails"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects/{objectName}/details"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( bucketKey != null ) + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + if ( objectName != null ) + localVarPathParams.Add ("objectName", Configuration.ApiClient.ParameterToString (objectName)); // path parameter + if ( with != null ) + localVarQueryParams.Add ("with", Configuration.ApiClient.ParameterToString (with)); // query parameter + if ( ifModifiedSince != null ) + localVarHeaderParams.Add ("If-Modified-Since", Configuration.ApiClient.ParameterToString (ifModifiedSince)); // header parameter + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync (localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("GetObjectDetails", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(ObjectFullDetails)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (ObjectFullDetails))); + + } + + /// + /// List objects in a bucket. It is only available to the bucket creator. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// Limit to the response size, Acceptable values: 1-100 Default = 10 (optional, default to 10) + /// Provides a way to filter the based on object key name (optional) + /// Key to use as an offset to continue pagination This is typically the last bucket key found in a preceding GET buckets response (optional) + /// BucketObjects + public /*BucketObjects*/dynamic GetObjects (string bucketKey, int? limit = null, string beginsWith = null, string startAt = null) { + ApiResponse localVarResponse = GetObjectsWithHttpInfo (bucketKey, limit, beginsWith, startAt); + return localVarResponse.Data; + } + + /// + /// List objects in a bucket. It is only available to the bucket creator. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// Limit to the response size, Acceptable values: 1-100 Default = 10 (optional, default to 10) + /// Provides a way to filter the based on object key name (optional) + /// Key to use as an offset to continue pagination This is typically the last bucket key found in a preceding GET buckets response (optional) + /// ApiResponse of BucketObjects + public ApiResponse< /*BucketObjects*/dynamic> GetObjectsWithHttpInfo (string bucketKey, int? limit = null, string beginsWith = null, string startAt = null) { + // verify the required parameter 'bucketKey' is set + if ( bucketKey == null ) + throw new ApiException (400, "Missing required parameter 'bucketKey' when calling ObjectsApi->GetObjects"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( bucketKey != null ) + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + if ( limit != null ) + localVarQueryParams.Add ("limit", Configuration.ApiClient.ParameterToString (limit)); // query parameter + if ( beginsWith != null ) + localVarQueryParams.Add ("beginsWith", Configuration.ApiClient.ParameterToString (beginsWith)); // query parameter + if ( startAt != null ) + localVarQueryParams.Add ("startAt", Configuration.ApiClient.ParameterToString (startAt)); // query parameter + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)Configuration.ApiClient.CallApi (localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("GetObjects", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(BucketObjects)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (BucketObjects))); + + } + + /// + /// List objects in a bucket. It is only available to the bucket creator. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// Limit to the response size, Acceptable values: 1-100 Default = 10 (optional, default to 10) + /// Provides a way to filter the based on object key name (optional) + /// Key to use as an offset to continue pagination This is typically the last bucket key found in a preceding GET buckets response (optional) + /// Task of BucketObjects + public async System.Threading.Tasks.Task GetObjectsAsync (string bucketKey, int? limit = null, string beginsWith = null, string startAt = null) { + ApiResponse localVarResponse = await GetObjectsAsyncWithHttpInfo (bucketKey, limit, beginsWith, startAt); + return localVarResponse.Data; + + } + + /// + /// List objects in a bucket. It is only available to the bucket creator. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// Limit to the response size, Acceptable values: 1-100 Default = 10 (optional, default to 10) + /// Provides a way to filter the based on object key name (optional) + /// Key to use as an offset to continue pagination This is typically the last bucket key found in a preceding GET buckets response (optional) + /// Task of ApiResponse (BucketObjects) + public async System.Threading.Tasks.Task> GetObjectsAsyncWithHttpInfo (string bucketKey, int? limit = null, string beginsWith = null, string startAt = null) { + // verify the required parameter 'bucketKey' is set + if ( bucketKey == null ) + throw new ApiException (400, "Missing required parameter 'bucketKey' when calling ObjectsApi->GetObjects"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( bucketKey != null ) + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + if ( limit != null ) + localVarQueryParams.Add ("limit", Configuration.ApiClient.ParameterToString (limit)); // query parameter + if ( beginsWith != null ) + localVarQueryParams.Add ("beginsWith", Configuration.ApiClient.ParameterToString (beginsWith)); // query parameter + if ( startAt != null ) + localVarQueryParams.Add ("startAt", Configuration.ApiClient.ParameterToString (startAt)); // query parameter + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync (localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("GetObjects", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(BucketObjects)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (BucketObjects))); + + } + + /// + /// Download an object using a signed URL. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// A range of bytes to download from the specified object. (optional) + /// The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. (optional) + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// System.IO.Stream + public /*System.IO.Stream*/dynamic GetSignedResource (string id, string range = null, string ifNoneMatch = null, DateTime? ifModifiedSince = null, string acceptEncoding = null, string region = null) { + ApiResponse localVarResponse = GetSignedResourceWithHttpInfo (id, range, ifNoneMatch, ifModifiedSince, acceptEncoding, region); + return localVarResponse.Data; + } + + /// + /// Download an object using a signed URL. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// A range of bytes to download from the specified object. (optional) + /// The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. (optional) + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// ApiResponse of System.IO.Stream + public ApiResponse< /*System.IO.Stream*/dynamic> GetSignedResourceWithHttpInfo (string id, string range = null, string ifNoneMatch = null, DateTime? ifModifiedSince = null, string acceptEncoding = null, string region = null) { + // verify the required parameter 'id' is set + if ( id == null ) + throw new ApiException (400, "Missing required parameter 'id' when calling ObjectsApi->GetSignedResource"); + + var localVarPath = "/oss/v2/signedresources/{id}"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/octet-stream" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( id != null ) + localVarPathParams.Add ("id", Configuration.ApiClient.ParameterToString (id)); // path parameter + if ( region != null ) + localVarQueryParams.Add ("region", Configuration.ApiClient.ParameterToString (region)); // query parameter + if ( range != null ) + localVarHeaderParams.Add ("Range", Configuration.ApiClient.ParameterToString (range)); // header parameter + if ( ifNoneMatch != null ) + localVarHeaderParams.Add ("If-None-Match", Configuration.ApiClient.ParameterToString (ifNoneMatch)); // header parameter + if ( ifModifiedSince != null ) + localVarHeaderParams.Add ("If-Modified-Since", Configuration.ApiClient.ParameterToString (ifModifiedSince)); // header parameter + if ( acceptEncoding != null ) + localVarHeaderParams.Add ("Accept-Encoding", Configuration.ApiClient.ParameterToString (acceptEncoding)); // header parameter + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)Configuration.ApiClient.CallApi (localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("GetSignedResource", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(System.IO.Stream)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (System.IO.Stream))); + + } + + /// + /// Download an object using a signed URL. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// A range of bytes to download from the specified object. (optional) + /// The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. (optional) + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Task of System.IO.Stream + public async System.Threading.Tasks.Task GetSignedResourceAsync (string id, string range = null, string ifNoneMatch = null, DateTime? ifModifiedSince = null, string acceptEncoding = null, string region = null) { + ApiResponse localVarResponse = await GetSignedResourceAsyncWithHttpInfo (id, range, ifNoneMatch, ifModifiedSince, acceptEncoding, region); + return localVarResponse.Data; + + } + + /// + /// Download an object using a signed URL. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// A range of bytes to download from the specified object. (optional) + /// The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. (optional) + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Task of ApiResponse (System.IO.Stream) + public async System.Threading.Tasks.Task> GetSignedResourceAsyncWithHttpInfo (string id, string range = null, string ifNoneMatch = null, DateTime? ifModifiedSince = null, string acceptEncoding = null, string region = null) { + // verify the required parameter 'id' is set + if ( id == null ) + throw new ApiException (400, "Missing required parameter 'id' when calling ObjectsApi->GetSignedResource"); + + var localVarPath = "/oss/v2/signedresources/{id}"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/octet-stream" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( id != null ) + localVarPathParams.Add ("id", Configuration.ApiClient.ParameterToString (id)); // path parameter + if ( region != null ) + localVarQueryParams.Add ("region", Configuration.ApiClient.ParameterToString (region)); // query parameter + if ( range != null ) + localVarHeaderParams.Add ("Range", Configuration.ApiClient.ParameterToString (range)); // header parameter + if ( ifNoneMatch != null ) + localVarHeaderParams.Add ("If-None-Match", Configuration.ApiClient.ParameterToString (ifNoneMatch)); // header parameter + if ( ifModifiedSince != null ) + localVarHeaderParams.Add ("If-Modified-Since", Configuration.ApiClient.ParameterToString (ifModifiedSince)); // header parameter + if ( acceptEncoding != null ) + localVarHeaderParams.Add ("Accept-Encoding", Configuration.ApiClient.ParameterToString (acceptEncoding)); // header parameter + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync (localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("GetSignedResource", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(System.IO.Stream)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (System.IO.Stream))); + + } + + /// + /// This endpoint returns status information about a resumable upload. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Unique identifier of a session of a file being uploaded + /// + public void GetStatusBySessionId (string bucketKey, string objectName, string sessionId) { + GetStatusBySessionIdWithHttpInfo (bucketKey, objectName, sessionId); + } + + /// + /// This endpoint returns status information about a resumable upload. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Unique identifier of a session of a file being uploaded + /// ApiResponse of Object(void) + public ApiResponse GetStatusBySessionIdWithHttpInfo (string bucketKey, string objectName, string sessionId) { + // verify the required parameter 'bucketKey' is set + if ( bucketKey == null ) + throw new ApiException (400, "Missing required parameter 'bucketKey' when calling ObjectsApi->GetStatusBySessionId"); + // verify the required parameter 'objectName' is set + if ( objectName == null ) + throw new ApiException (400, "Missing required parameter 'objectName' when calling ObjectsApi->GetStatusBySessionId"); + // verify the required parameter 'sessionId' is set + if ( sessionId == null ) + throw new ApiException (400, "Missing required parameter 'sessionId' when calling ObjectsApi->GetStatusBySessionId"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects/{objectName}/status/{sessionId}"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( bucketKey != null ) + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + if ( objectName != null ) + localVarPathParams.Add ("objectName", Configuration.ApiClient.ParameterToString (objectName)); // path parameter + if ( sessionId != null ) + localVarPathParams.Add ("sessionId", Configuration.ApiClient.ParameterToString (sessionId)); // path parameter + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)Configuration.ApiClient.CallApi (localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("GetStatusBySessionId", localVarResponse); + if ( exception != null ) + throw exception; + } + + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + null); + } + + /// + /// This endpoint returns status information about a resumable upload. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Unique identifier of a session of a file being uploaded + /// Task of void + public async System.Threading.Tasks.Task GetStatusBySessionIdAsync (string bucketKey, string objectName, string sessionId) { + await GetStatusBySessionIdAsyncWithHttpInfo (bucketKey, objectName, sessionId); + + } + + /// + /// This endpoint returns status information about a resumable upload. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Unique identifier of a session of a file being uploaded + /// Task of ApiResponse + public async System.Threading.Tasks.Task> GetStatusBySessionIdAsyncWithHttpInfo (string bucketKey, string objectName, string sessionId) { + // verify the required parameter 'bucketKey' is set + if ( bucketKey == null ) + throw new ApiException (400, "Missing required parameter 'bucketKey' when calling ObjectsApi->GetStatusBySessionId"); + // verify the required parameter 'objectName' is set + if ( objectName == null ) + throw new ApiException (400, "Missing required parameter 'objectName' when calling ObjectsApi->GetStatusBySessionId"); + // verify the required parameter 'sessionId' is set + if ( sessionId == null ) + throw new ApiException (400, "Missing required parameter 'sessionId' when calling ObjectsApi->GetStatusBySessionId"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects/{objectName}/status/{sessionId}"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( bucketKey != null ) + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + if ( objectName != null ) + localVarPathParams.Add ("objectName", Configuration.ApiClient.ParameterToString (objectName)); // path parameter + if ( sessionId != null ) + localVarPathParams.Add ("sessionId", Configuration.ApiClient.ParameterToString (sessionId)); // path parameter + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync (localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("GetStatusBySessionId", localVarResponse); + if ( exception != null ) + throw exception; + } + + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + null); + } + + /// + /// This endpoint allows resumable uploads for large files in chunks. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Indicates the size of the request body. + /// Byte range of a segment being uploaded + /// Unique identifier of a session of a file being uploaded + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// ObjectDetails + public /*ObjectDetails*/dynamic UploadChunk (string bucketKey, string objectName, int? contentLength, string contentRange, string sessionId, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream") { + ApiResponse localVarResponse = UploadChunkWithHttpInfo (bucketKey, objectName, contentLength, contentRange, sessionId, body, contentDisposition, ifMatch, contentType); + return localVarResponse.Data; + } + + /// + /// This endpoint allows resumable uploads for large files in chunks. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Indicates the size of the request body. + /// Byte range of a segment being uploaded + /// Unique identifier of a session of a file being uploaded + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// ApiResponse of ObjectDetails + public ApiResponse< /*ObjectDetails*/dynamic> UploadChunkWithHttpInfo (string bucketKey, string objectName, int? contentLength, string contentRange, string sessionId, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream") { + // verify the required parameter 'bucketKey' is set + if ( bucketKey == null ) + throw new ApiException (400, "Missing required parameter 'bucketKey' when calling ObjectsApi->UploadChunk"); + // verify the required parameter 'objectName' is set + if ( objectName == null ) + throw new ApiException (400, "Missing required parameter 'objectName' when calling ObjectsApi->UploadChunk"); + // verify the required parameter 'contentLength' is set + if ( contentLength == null ) + throw new ApiException (400, "Missing required parameter 'contentLength' when calling ObjectsApi->UploadChunk"); + // verify the required parameter 'contentRange' is set + if ( contentRange == null ) + throw new ApiException (400, "Missing required parameter 'contentRange' when calling ObjectsApi->UploadChunk"); + // verify the required parameter 'sessionId' is set + if ( sessionId == null ) + throw new ApiException (400, "Missing required parameter 'sessionId' when calling ObjectsApi->UploadChunk"); + // verify the required parameter 'body' is set + if ( body == null ) + throw new ApiException (400, "Missing required parameter 'body' when calling ObjectsApi->UploadChunk"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects/{objectName}/resumable"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + contentType + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( bucketKey != null ) + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + if ( objectName != null ) + localVarPathParams.Add ("objectName", Configuration.ApiClient.ParameterToString (objectName)); // path parameter + if ( contentLength != null ) + localVarHeaderParams.Add ("Content-Length", Configuration.ApiClient.ParameterToString (contentLength)); // header parameter + if ( contentRange != null ) + localVarHeaderParams.Add ("Content-Range", Configuration.ApiClient.ParameterToString (contentRange)); // header parameter + if ( contentDisposition != null ) + localVarHeaderParams.Add ("Content-Disposition", Configuration.ApiClient.ParameterToString (contentDisposition)); // header parameter + if ( ifMatch != null ) + localVarHeaderParams.Add ("If-Match", Configuration.ApiClient.ParameterToString (ifMatch)); // header parameter + if ( sessionId != null ) + localVarHeaderParams.Add ("Session-Id", Configuration.ApiClient.ParameterToString (sessionId)); // header parameter + if ( body != null && body.GetType () == typeof (byte []) ) // http body (model) parameter + { + localVarPostBody = body; // byte array + } else if ( body != null + && (body.GetType () == typeof (System.IO.FileStream) + || body.GetType () == typeof (System.IO.BinaryReader) + || body.GetType () == typeof (System.IO.BufferedStream) + || body.GetType () == typeof (System.IO.MemoryStream) + || body.GetType () == typeof (System.IO.StreamReader) + ) + ) { + localVarPostBody = Configuration.ApiClient.toByteArray (body); // byte array + } else if ( body != null ) { + localVarPostBody = Configuration.ApiClient.Serialize (body); + } + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)Configuration.ApiClient.CallApi (localVarPath, + Method.Put, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("UploadChunk", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(ObjectDetails)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (ObjectDetails))); + + } + + /// + /// This endpoint allows resumable uploads for large files in chunks. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Indicates the size of the request body. + /// Byte range of a segment being uploaded + /// Unique identifier of a session of a file being uploaded + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// Task of ObjectDetails + public async System.Threading.Tasks.Task UploadChunkAsync (string bucketKey, string objectName, int? contentLength, string contentRange, string sessionId, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream") { + ApiResponse localVarResponse = await UploadChunkAsyncWithHttpInfo (bucketKey, objectName, contentLength, contentRange, sessionId, body, contentDisposition, ifMatch, contentType); + return localVarResponse.Data; + + } + + /// + /// This endpoint allows resumable uploads for large files in chunks. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Indicates the size of the request body. + /// Byte range of a segment being uploaded + /// Unique identifier of a session of a file being uploaded + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// Task of ApiResponse (ObjectDetails) + public async System.Threading.Tasks.Task> UploadChunkAsyncWithHttpInfo (string bucketKey, string objectName, int? contentLength, string contentRange, string sessionId, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream") { + // verify the required parameter 'bucketKey' is set + if ( bucketKey == null ) + throw new ApiException (400, "Missing required parameter 'bucketKey' when calling ObjectsApi->UploadChunk"); + // verify the required parameter 'objectName' is set + if ( objectName == null ) + throw new ApiException (400, "Missing required parameter 'objectName' when calling ObjectsApi->UploadChunk"); + // verify the required parameter 'contentLength' is set + if ( contentLength == null ) + throw new ApiException (400, "Missing required parameter 'contentLength' when calling ObjectsApi->UploadChunk"); + // verify the required parameter 'contentRange' is set + if ( contentRange == null ) + throw new ApiException (400, "Missing required parameter 'contentRange' when calling ObjectsApi->UploadChunk"); + // verify the required parameter 'sessionId' is set + if ( sessionId == null ) + throw new ApiException (400, "Missing required parameter 'sessionId' when calling ObjectsApi->UploadChunk"); + // verify the required parameter 'body' is set + if ( body == null ) + throw new ApiException (400, "Missing required parameter 'body' when calling ObjectsApi->UploadChunk"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects/{objectName}/resumable"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + contentType + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( bucketKey != null ) + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + if ( objectName != null ) + localVarPathParams.Add ("objectName", Configuration.ApiClient.ParameterToString (objectName)); // path parameter + if ( contentLength != null ) + localVarHeaderParams.Add ("Content-Length", Configuration.ApiClient.ParameterToString (contentLength)); // header parameter + if ( contentRange != null ) + localVarHeaderParams.Add ("Content-Range", Configuration.ApiClient.ParameterToString (contentRange)); // header parameter + if ( contentDisposition != null ) + localVarHeaderParams.Add ("Content-Disposition", Configuration.ApiClient.ParameterToString (contentDisposition)); // header parameter + if ( ifMatch != null ) + localVarHeaderParams.Add ("If-Match", Configuration.ApiClient.ParameterToString (ifMatch)); // header parameter + if ( sessionId != null ) + localVarHeaderParams.Add ("Session-Id", Configuration.ApiClient.ParameterToString (sessionId)); // header parameter + if ( body != null && body.GetType () == typeof (byte []) ) // http body (model) parameter + { + localVarPostBody = body; // byte array + } else if ( body != null + && (body.GetType () == typeof (System.IO.FileStream) + || body.GetType () == typeof (System.IO.BinaryReader) + || body.GetType () == typeof (System.IO.BufferedStream) + || body.GetType () == typeof (System.IO.MemoryStream) + || body.GetType () == typeof (System.IO.StreamReader) + ) + ) { + localVarPostBody = Configuration.ApiClient.toByteArray (body); // byte array + } else if ( body != null ) { + localVarPostBody = Configuration.ApiClient.Serialize (body); + } + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync (localVarPath, + Method.Put, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("UploadChunk", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(ObjectDetails)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (ObjectDetails))); + + } + + /// + /// Upload an object. If the specified object name already exists in the bucket, the uploaded content will overwrite the existing content for the bucket name/object name combination. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Indicates the size of the request body. + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// ObjectDetails + public /*ObjectDetails*/dynamic UploadObject (string bucketKey, string objectName, int? contentLength, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream") { + ApiResponse localVarResponse = UploadObjectWithHttpInfo (bucketKey, objectName, contentLength, body, contentDisposition, ifMatch, contentType); + return localVarResponse.Data; + } + + /// + /// Upload an object. If the specified object name already exists in the bucket, the uploaded content will overwrite the existing content for the bucket name/object name combination. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Indicates the size of the request body. + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// ApiResponse of ObjectDetails + public ApiResponse< /*ObjectDetails*/dynamic> UploadObjectWithHttpInfo (string bucketKey, string objectName, int? contentLength, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream") { + // verify the required parameter 'bucketKey' is set + if ( bucketKey == null ) + throw new ApiException (400, "Missing required parameter 'bucketKey' when calling ObjectsApi->UploadObject"); + // verify the required parameter 'objectName' is set + if ( objectName == null ) + throw new ApiException (400, "Missing required parameter 'objectName' when calling ObjectsApi->UploadObject"); + // verify the required parameter 'contentLength' is set + if ( contentLength == null ) + throw new ApiException (400, "Missing required parameter 'contentLength' when calling ObjectsApi->UploadObject"); + // verify the required parameter 'body' is set + if ( body == null ) + throw new ApiException (400, "Missing required parameter 'body' when calling ObjectsApi->UploadObject"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects/{objectName}"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + contentType + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( bucketKey != null ) + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + if ( objectName != null ) + localVarPathParams.Add ("objectName", Configuration.ApiClient.ParameterToString (objectName)); // path parameter + if ( contentLength != null ) + localVarHeaderParams.Add ("Content-Length", Configuration.ApiClient.ParameterToString (contentLength)); // header parameter + if ( contentDisposition != null ) + localVarHeaderParams.Add ("Content-Disposition", Configuration.ApiClient.ParameterToString (contentDisposition)); // header parameter + if ( ifMatch != null ) + localVarHeaderParams.Add ("If-Match", Configuration.ApiClient.ParameterToString (ifMatch)); // header parameter + if ( body != null && body.GetType () == typeof (byte []) ) // http body (model) parameter + { + localVarPostBody = body; // byte array + } else if ( body != null + && (body.GetType () == typeof (System.IO.FileStream) + || body.GetType () == typeof (System.IO.BinaryReader) + || body.GetType () == typeof (System.IO.BufferedStream) + || body.GetType () == typeof (System.IO.MemoryStream) + || body.GetType () == typeof (System.IO.StreamReader) + ) + ) { + localVarPostBody = Configuration.ApiClient.toByteArray (body); // byte array + } else if ( body != null ) { + localVarPostBody = Configuration.ApiClient.Serialize (body); + } + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)Configuration.ApiClient.CallApi (localVarPath, + Method.Put, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("UploadObject", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(ObjectDetails)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (ObjectDetails))); + + } + + /// + /// Upload an object. If the specified object name already exists in the bucket, the uploaded content will overwrite the existing content for the bucket name/object name combination. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Indicates the size of the request body. + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// Task of ObjectDetails + public async System.Threading.Tasks.Task UploadObjectAsync (string bucketKey, string objectName, int? contentLength, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream") { + ApiResponse localVarResponse = await UploadObjectAsyncWithHttpInfo (bucketKey, objectName, contentLength, body, contentDisposition, ifMatch, contentType); + return localVarResponse.Data; + + } + + /// + /// Upload an object. If the specified object name already exists in the bucket, the uploaded content will overwrite the existing content for the bucket name/object name combination. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Indicates the size of the request body. + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// Task of ApiResponse (ObjectDetails) + public async System.Threading.Tasks.Task> UploadObjectAsyncWithHttpInfo (string bucketKey, string objectName, int? contentLength, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream") { + // verify the required parameter 'bucketKey' is set + if ( bucketKey == null ) + throw new ApiException (400, "Missing required parameter 'bucketKey' when calling ObjectsApi->UploadObject"); + // verify the required parameter 'objectName' is set + if ( objectName == null ) + throw new ApiException (400, "Missing required parameter 'objectName' when calling ObjectsApi->UploadObject"); + // verify the required parameter 'contentLength' is set + if ( contentLength == null ) + throw new ApiException (400, "Missing required parameter 'contentLength' when calling ObjectsApi->UploadObject"); + // verify the required parameter 'body' is set + if ( body == null ) + throw new ApiException (400, "Missing required parameter 'body' when calling ObjectsApi->UploadObject"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects/{objectName}"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + contentType + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( bucketKey != null ) + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + if ( objectName != null ) + localVarPathParams.Add ("objectName", Configuration.ApiClient.ParameterToString (objectName)); // path parameter + if ( contentLength != null ) + localVarHeaderParams.Add ("Content-Length", Configuration.ApiClient.ParameterToString (contentLength)); // header parameter + if ( contentDisposition != null ) + localVarHeaderParams.Add ("Content-Disposition", Configuration.ApiClient.ParameterToString (contentDisposition)); // header parameter + if ( ifMatch != null ) + localVarHeaderParams.Add ("If-Match", Configuration.ApiClient.ParameterToString (ifMatch)); // header parameter + if ( body != null && body.GetType () == typeof (byte []) ) // http body (model) parameter + { + localVarPostBody = body; // byte array + } else if ( body != null + && (body.GetType () == typeof (System.IO.FileStream) + || body.GetType () == typeof (System.IO.BinaryReader) + || body.GetType () == typeof (System.IO.BufferedStream) + || body.GetType () == typeof (System.IO.MemoryStream) + || body.GetType () == typeof (System.IO.StreamReader) + ) + ) { + localVarPostBody = Configuration.ApiClient.toByteArray (body); // byte array + } else if ( body != null ) { + localVarPostBody = Configuration.ApiClient.Serialize (body); + } + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync (localVarPath, + Method.Put, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("UploadObject", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(ObjectDetails)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (ObjectDetails))); + + } + + /// + /// Overwrite a existing object using a signed URL. Conditions to call this operation: Object is available Expiration period is valid Signed URL should be created with `write` or `readwrite` + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// Indicates the size of the request body. + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// ObjectDetails + public /*ObjectDetails*/dynamic UploadSignedResource (string id, int? contentLength, System.IO.Stream body, string contentDisposition = null, string xAdsRegion = null, string ifMatch = null, string contentType = "application/octet-stream") { + ApiResponse localVarResponse = UploadSignedResourceWithHttpInfo (id, contentLength, body, contentDisposition, xAdsRegion, ifMatch, contentType); + return localVarResponse.Data; + } + + /// + /// Overwrite a existing object using a signed URL. Conditions to call this operation: Object is available Expiration period is valid Signed URL should be created with `write` or `readwrite` + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// Indicates the size of the request body. + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// ApiResponse of ObjectDetails + public ApiResponse< /*ObjectDetails*/dynamic> UploadSignedResourceWithHttpInfo (string id, int? contentLength, System.IO.Stream body, string contentDisposition = null, string xAdsRegion = null, string ifMatch = null, string contentType = "application/octet-stream") { + // verify the required parameter 'id' is set + if ( id == null ) + throw new ApiException (400, "Missing required parameter 'id' when calling ObjectsApi->UploadSignedResource"); + // verify the required parameter 'contentLength' is set + if ( contentLength == null ) + throw new ApiException (400, "Missing required parameter 'contentLength' when calling ObjectsApi->UploadSignedResource"); + // verify the required parameter 'body' is set + if ( body == null ) + throw new ApiException (400, "Missing required parameter 'body' when calling ObjectsApi->UploadSignedResource"); + + var localVarPath = "/oss/v2/signedresources/{id}"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + contentType + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( id != null ) + localVarPathParams.Add ("id", Configuration.ApiClient.ParameterToString (id)); // path parameter + if ( contentLength != null ) + localVarHeaderParams.Add ("Content-Length", Configuration.ApiClient.ParameterToString (contentLength)); // header parameter + if ( contentDisposition != null ) + localVarHeaderParams.Add ("Content-Disposition", Configuration.ApiClient.ParameterToString (contentDisposition)); // header parameter + if ( xAdsRegion != null ) + localVarHeaderParams.Add ("x-ads-region", Configuration.ApiClient.ParameterToString (xAdsRegion)); // header parameter + if ( ifMatch != null ) + localVarHeaderParams.Add ("If-Match", Configuration.ApiClient.ParameterToString (ifMatch)); // header parameter + if ( body != null && body.GetType () == typeof (byte []) ) // http body (model) parameter + { + localVarPostBody = body; // byte array + } else if ( body != null + && (body.GetType () == typeof (System.IO.FileStream) + || body.GetType () == typeof (System.IO.BinaryReader) + || body.GetType () == typeof (System.IO.BufferedStream) + || body.GetType () == typeof (System.IO.MemoryStream) + || body.GetType () == typeof (System.IO.StreamReader) + ) + ) { + localVarPostBody = Configuration.ApiClient.toByteArray (body); // byte array + } else if ( body != null ) { + localVarPostBody = Configuration.ApiClient.Serialize (body); + } + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)Configuration.ApiClient.CallApi (localVarPath, + Method.Put, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("UploadSignedResource", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(ObjectDetails)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (ObjectDetails))); + + } + + /// + /// Overwrite a existing object using a signed URL. Conditions to call this operation: Object is available Expiration period is valid Signed URL should be created with `write` or `readwrite` + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// Indicates the size of the request body. + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// Task of ObjectDetails + public async System.Threading.Tasks.Task UploadSignedResourceAsync (string id, int? contentLength, System.IO.Stream body, string contentDisposition = null, string xAdsRegion = null, string ifMatch = null, string contentType = "application/octet-stream") { + ApiResponse localVarResponse = await UploadSignedResourceAsyncWithHttpInfo (id, contentLength, body, contentDisposition, xAdsRegion, ifMatch, contentType); + return localVarResponse.Data; + + } + + /// + /// Overwrite a existing object using a signed URL. Conditions to call this operation: Object is available Expiration period is valid Signed URL should be created with `write` or `readwrite` + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// Indicates the size of the request body. + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// Task of ApiResponse (ObjectDetails) + public async System.Threading.Tasks.Task> UploadSignedResourceAsyncWithHttpInfo (string id, int? contentLength, System.IO.Stream body, string contentDisposition = null, string xAdsRegion = null, string ifMatch = null, string contentType = "application/octet-stream") { + // verify the required parameter 'id' is set + if ( id == null ) + throw new ApiException (400, "Missing required parameter 'id' when calling ObjectsApi->UploadSignedResource"); + // verify the required parameter 'contentLength' is set + if ( contentLength == null ) + throw new ApiException (400, "Missing required parameter 'contentLength' when calling ObjectsApi->UploadSignedResource"); + // verify the required parameter 'body' is set + if ( body == null ) + throw new ApiException (400, "Missing required parameter 'body' when calling ObjectsApi->UploadSignedResource"); + + var localVarPath = "/oss/v2/signedresources/{id}"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + contentType + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( id != null ) + localVarPathParams.Add ("id", Configuration.ApiClient.ParameterToString (id)); // path parameter + if ( contentLength != null ) + localVarHeaderParams.Add ("Content-Length", Configuration.ApiClient.ParameterToString (contentLength)); // header parameter + if ( contentDisposition != null ) + localVarHeaderParams.Add ("Content-Disposition", Configuration.ApiClient.ParameterToString (contentDisposition)); // header parameter + if ( xAdsRegion != null ) + localVarHeaderParams.Add ("x-ads-region", Configuration.ApiClient.ParameterToString (xAdsRegion)); // header parameter + if ( ifMatch != null ) + localVarHeaderParams.Add ("If-Match", Configuration.ApiClient.ParameterToString (ifMatch)); // header parameter + if ( body != null && body.GetType () == typeof (byte []) ) // http body (model) parameter + { + localVarPostBody = body; // byte array + } else if ( body != null + && (body.GetType () == typeof (System.IO.FileStream) + || body.GetType () == typeof (System.IO.BinaryReader) + || body.GetType () == typeof (System.IO.BufferedStream) + || body.GetType () == typeof (System.IO.MemoryStream) + || body.GetType () == typeof (System.IO.StreamReader) + ) + ) { + localVarPostBody = Configuration.ApiClient.toByteArray (body); // byte array + } else if ( body != null ) { + localVarPostBody = Configuration.ApiClient.Serialize (body); + } + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync (localVarPath, + Method.Put, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("UploadSignedResource", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(ObjectDetails)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (ObjectDetails))); + + } + + /// + /// Resumable upload for signed URLs. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// Byte range of a segment being uploaded + /// Unique identifier of a session of a file being uploaded + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// ObjectDetails + public /*ObjectDetails*/dynamic UploadSignedResourcesChunk (string id, string contentRange, string sessionId, System.IO.Stream body, string contentDisposition = null, string xAdsRegion = null, string contentType = "application/octet-stream") { + ApiResponse localVarResponse = UploadSignedResourcesChunkWithHttpInfo (id, contentRange, sessionId, body, contentDisposition, xAdsRegion, contentType); + return localVarResponse.Data; + } + + /// + /// Resumable upload for signed URLs. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// Byte range of a segment being uploaded + /// Unique identifier of a session of a file being uploaded + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// ApiResponse of ObjectDetails + public ApiResponse< /*ObjectDetails*/dynamic> UploadSignedResourcesChunkWithHttpInfo (string id, string contentRange, string sessionId, System.IO.Stream body, string contentDisposition = null, string xAdsRegion = null, string contentType = "application/octet-stream") { + // verify the required parameter 'id' is set + if ( id == null ) + throw new ApiException (400, "Missing required parameter 'id' when calling ObjectsApi->UploadSignedResourcesChunk"); + // verify the required parameter 'contentRange' is set + if ( contentRange == null ) + throw new ApiException (400, "Missing required parameter 'contentRange' when calling ObjectsApi->UploadSignedResourcesChunk"); + // verify the required parameter 'sessionId' is set + if ( sessionId == null ) + throw new ApiException (400, "Missing required parameter 'sessionId' when calling ObjectsApi->UploadSignedResourcesChunk"); + // verify the required parameter 'body' is set + if ( body == null ) + throw new ApiException (400, "Missing required parameter 'body' when calling ObjectsApi->UploadSignedResourcesChunk"); + + var localVarPath = "/oss/v2/signedresources/{id}/resumable"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + contentType + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( id != null ) + localVarPathParams.Add ("id", Configuration.ApiClient.ParameterToString (id)); // path parameter + if ( contentRange != null ) + localVarHeaderParams.Add ("Content-Range", Configuration.ApiClient.ParameterToString (contentRange)); // header parameter + if ( contentDisposition != null ) + localVarHeaderParams.Add ("Content-Disposition", Configuration.ApiClient.ParameterToString (contentDisposition)); // header parameter + if ( xAdsRegion != null ) + localVarHeaderParams.Add ("x-ads-region", Configuration.ApiClient.ParameterToString (xAdsRegion)); // header parameter + if ( sessionId != null ) + localVarHeaderParams.Add ("Session-Id", Configuration.ApiClient.ParameterToString (sessionId)); // header parameter + if ( body != null && body.GetType () == typeof (byte []) ) // http body (model) parameter + { + localVarPostBody = body; // byte array + } else if ( body != null + && (body.GetType () == typeof (System.IO.FileStream) + || body.GetType () == typeof (System.IO.BinaryReader) + || body.GetType () == typeof (System.IO.BufferedStream) + || body.GetType () == typeof (System.IO.MemoryStream) + || body.GetType () == typeof (System.IO.StreamReader) + ) + ) { + localVarPostBody = Configuration.ApiClient.toByteArray (body); // byte array + } else if ( body != null ) { + localVarPostBody = Configuration.ApiClient.Serialize (body); + } + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)Configuration.ApiClient.CallApi (localVarPath, + Method.Put, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("UploadSignedResourcesChunk", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(ObjectDetails)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (ObjectDetails))); + + } + + /// + /// Resumable upload for signed URLs. + /// + /// Thrown when fails to make API call + /// Id of signed resource + /// Byte range of a segment being uploaded + /// Unique identifier of a session of a file being uploaded + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Task of ObjectDetails + public async System.Threading.Tasks.Task UploadSignedResourcesChunkAsync (string id, string contentRange, string sessionId, System.IO.Stream body, string contentDisposition = null, string xAdsRegion = null, string contentType = "application/octet-stream") { + ApiResponse localVarResponse = await UploadSignedResourcesChunkAsyncWithHttpInfo (id, contentRange, sessionId, body, contentDisposition, xAdsRegion, contentType); + return localVarResponse.Data; + } + + /// Resumable upload for signed URLs. + /// Thrown when fails to make API call + /// Id of signed resource + /// Byte range of a segment being uploaded + /// Unique identifier of a session of a file being uploaded + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// Task of ApiResponse (ObjectDetails) + public async System.Threading.Tasks.Task> UploadSignedResourcesChunkAsyncWithHttpInfo (string id, string contentRange, string sessionId, System.IO.Stream body, string contentDisposition = null, string xAdsRegion = null, string contentType = "application/octet-stream") { + // verify the required parameter 'id' is set + if ( id == null ) + throw new ApiException (400, "Missing required parameter 'id' when calling ObjectsApi->UploadSignedResourcesChunk"); + // verify the required parameter 'contentRange' is set + if ( contentRange == null ) + throw new ApiException (400, "Missing required parameter 'contentRange' when calling ObjectsApi->UploadSignedResourcesChunk"); + // verify the required parameter 'sessionId' is set + if ( sessionId == null ) + throw new ApiException (400, "Missing required parameter 'sessionId' when calling ObjectsApi->UploadSignedResourcesChunk"); + // verify the required parameter 'body' is set + if ( body == null ) + throw new ApiException (400, "Missing required parameter 'body' when calling ObjectsApi->UploadSignedResourcesChunk"); + + var localVarPath = "/oss/v2/signedresources/{id}/resumable"; + var localVarPathParams = new Dictionary (); + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + contentType + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( localVarHttpHeaderAccept != null ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add ("format", "json"); + if ( id != null ) + localVarPathParams.Add ("id", Configuration.ApiClient.ParameterToString (id)); // path parameter + if ( contentRange != null ) + localVarHeaderParams.Add ("Content-Range", Configuration.ApiClient.ParameterToString (contentRange)); // header parameter + if ( contentDisposition != null ) + localVarHeaderParams.Add ("Content-Disposition", Configuration.ApiClient.ParameterToString (contentDisposition)); // header parameter + if ( xAdsRegion != null ) + localVarHeaderParams.Add ("x-ads-region", Configuration.ApiClient.ParameterToString (xAdsRegion)); // header parameter + if ( sessionId != null ) + localVarHeaderParams.Add ("Session-Id", Configuration.ApiClient.ParameterToString (sessionId)); // header parameter + if ( body != null && body.GetType () == typeof (byte []) ) // http body (model) parameter + { + localVarPostBody = body; // byte array + } else if ( body != null + && (body.GetType () == typeof (System.IO.FileStream) + || body.GetType () == typeof (System.IO.BinaryReader) + || body.GetType () == typeof (System.IO.BufferedStream) + || body.GetType () == typeof (System.IO.MemoryStream) + || body.GetType () == typeof (System.IO.StreamReader) + ) + ) { + localVarPostBody = Configuration.ApiClient.toByteArray (body); // byte array + } else if ( body != null ) { + localVarPostBody = Configuration.ApiClient.Serialize (body); + } + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) { + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync (localVarPath, + Method.Put, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("UploadSignedResourcesChunk", localVarResponse); + if ( exception != null ) + throw exception; + } + + return new ApiResponse (localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + /*(ObjectDetails)*/ Configuration.ApiClient.Deserialize (localVarResponse, typeof (ObjectDetails))); + + } + + #region Direct S3 + + protected Dictionary Opts2Dictionary (Dictionary opts, Dictionary keys, Dictionary input = null) { + if ( input == null ) + input = new Dictionary (); + if ( opts == null ) + return (input); + + foreach ( var param in opts ) { + if ( keys.ContainsKey (param.Key) ) + input.Add (keys [param.Key], Configuration.ApiClient.ParameterToString (param.Value)); + } + + return (input); + } + + /// summary>Returns a signed S3 URL. + /// Thrown when fails to make API call + /// {String} bucket key (will be URL-encoded automatically) + /// {String} object key (will be URL-encoded automatically) + /// {Object=} Optional parameters + /// {String=} If the value of this header matches the ETag of the object, an entity will not be returned from the server; + /// instead a 304 (not modified) response will be returned without any message-body. + /// {Date=} If the requested object has not been modified since the time specified in this field, + /// an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message-body. + /// {String=} Value of the Content-Type header that the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {String=} Value of the Content Disposition header the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {String=} Value of the Cache-Control header that the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {Boolean=false} Allows fallback to OSS signed URLs in case of unmerged resumable uploads. + /// {Boolean=true} Will generate a CloudFront URL for the S3 object. + /// {Integer=2} The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectKey-signeds3download-GET/ + /// Task of ApiResponse (ObjectS3Download) + public async System.Threading.Tasks.Task getS3DownloadURLAsync (string bucketKey, string objectKey, Dictionary opts = null) { + ApiResponse localVarResponse = await getS3DownloadURLAsyncWithHttpInfo (bucketKey, objectKey, opts); + return (localVarResponse.Data); + } + + /// summary>Returns a signed S3 URL. + /// Thrown when fails to make API call + /// {String} bucket key (will be URL-encoded automatically) + /// {String} object key (will be URL-encoded automatically) + /// {Object=} Optional parameters + /// {String=} If the value of this header matches the ETag of the object, an entity will not be returned from the server; + /// instead a 304 (not modified) response will be returned without any message-body. + /// {Date=} If the requested object has not been modified since the time specified in this field, + /// an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message-body. + /// {String=} Value of the Content-Type header that the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {String=} Value of the Content Disposition header the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {String=} Value of the Cache-Control header that the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {Boolean=false} Allows fallback to OSS signed URLs in case of unmerged resumable uploads. + /// {Boolean=true} Will generate a CloudFront URL for the S3 object. + /// {Integer=2} The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectKey-signeds3download-GET/ + /// Task of ApiResponse (ObjectS3Download) + public async System.Threading.Tasks.Task> getS3DownloadURLAsyncWithHttpInfo (string bucketKey, string objectKey, Dictionary opts = null) { + // verify the required parameter 'bucketKey' is set + if ( String.IsNullOrEmpty (bucketKey) ) + throw new ApiException (400, "Missing the required parameter 'bucketKey' when calling getS3DownloadURLAsyncWithHttpInfo"); + // verify the required parameter 'objectKey' is set + if ( String.IsNullOrEmpty (objectKey) ) + throw new ApiException (400, "Missing the required parameter 'objectKey' when calling getS3DownloadURLAsyncWithHttpInfo"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects/{objectKey}/signeds3download"; + var localVarPathParams = new Dictionary (); + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + localVarPathParams.Add ("objectKey", Configuration.ApiClient.ParameterToString (objectKey)); // path parameter + var localVarQueryParams = Opts2Dictionary ( + opts, + new Dictionary () { + { "response-content-type", "response-content-type" }, + { "response-content-disposition","response-content-disposition" }, + { "response-cache-control", "response-cache-control" }, + { "public-resource-fallback", "public-resource-fallback" }, + { "responseContentType", "response-content-type" }, + { "responseContentDisposition","response-content-disposition" }, + { "responseCacheControl", "response-cache-control" }, + { "publicResourceFallback", "public-resource-fallback" }, + { "useCdn", "useCdn" }, + { "minutesExpiration", "minutesExpiration" } + } + ); + + var localVarHeaderParams = Opts2Dictionary ( + opts, + new Dictionary () { + { "If-None-Match", "If-None-Match" }, + { "If-Modified-Since", "If-Modified-Since" }, + { "ifNoneMatch", "If-None-Match" }, + { "ifModifiedSince", "If-Modified-Since" } + }, + new Dictionary (Configuration.DefaultHeader) + ); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + //String [] localVarHttpContentTypes = new String [] { + // contentType + //}; + //String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + String localVarHttpContentType = null; + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( !String.IsNullOrEmpty (localVarHttpHeaderAccept) ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync ( + localVarPath, Method.Get, + localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType + ); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("getS3DownloadURLAsyncWithHttpInfo", localVarResponse); + if ( exception != null ) + throw exception; + } + + return (new ApiResponse ( + localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + Configuration.ApiClient.Deserialize (localVarResponse, null) + )); + } + + /// + /// Gets one or more signed URLs to objects. The signed URLs can be used to download the objects directly from S3, skipping OSS servers. + /// Be aware that expiration time for the signed URL(s) is just 60 seconds. So, a request to the URL(s) must begin within 60 seconds; the transfer + /// of the data can exceed 60 seconds. + /// A successful call to this endpoint requires bucket owner access. + /// Note that resumable uploads store each chunk individually. After upload completes, an async process merges all the chunks and creates the + /// definitive OSS file. This async process can take time. If you request an S3 download URL before the async process completes, the response returns + /// a map of S3 URLs, one per chunk where the key is the corresponding range bytes. In case you don't want multiple URLs in the response, you can use + /// OSS signed URL functionality , with the public-resource-fallback query parameter set to true. + /// Note: While this endpoint does not support range headers, the returned URL(s) can be used for ranged downloads. This way, downloads can be + /// parallelized using multiple ranges for maximum speed. + /// + /// {String} bucket key (will be URL-encoded automatically) + /// {Object} body parameter + /// {Object[]} An array of objects representing each request to get an S3 URL to download from. + /// {String} Object name to create a download S3 signed URL for + /// {String=} Value of the Content-Type header that the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {String=} Value of the Content Disposition header the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {String=} Value of the Cache-Control header that the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {String=} The value of this attribute is compared to the ETAG of the object. + /// If they match, the response body will show the status of this item as "skipped" with the reason as "Not modified". + /// {Date=} If the requested object has not been modified since the time specified in this attribute, + /// the response body will show the status of this item as "skipped" with the reason as "Not modified". + /// {Object=} Optional parameters + /// {Boolean=false} (public-resource-fallback) Allows fallback to OSS signed URLs in case of unmerged resumable uploads. + /// {Boolean=true} Will generate a CloudFront URL for the S3 object. + /// {Integer=2} The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-batchsigneds3download-POST/ + /// Task of ApiResponse (dynamic) + public async System.Threading.Tasks.Task getS3DownloadURLsAsync (string bucketKey, PostBatchSignedS3DownloadPayload body, Dictionary opts = null) { + ApiResponse localVarResponse = await getS3DownloadURLsAsyncWithHttpInfo (bucketKey, body, opts); + return (localVarResponse.Data); + } + + /// + /// Gets one or more signed URLs to objects. The signed URLs can be used to download the objects directly from S3, skipping OSS servers. + /// Be aware that expiration time for the signed URL(s) is just 60 seconds. So, a request to the URL(s) must begin within 60 seconds; the transfer + /// of the data can exceed 60 seconds. + /// A successful call to this endpoint requires bucket owner access. + /// Note that resumable uploads store each chunk individually. After upload completes, an async process merges all the chunks and creates the + /// definitive OSS file. This async process can take time. If you request an S3 download URL before the async process completes, the response returns + /// a map of S3 URLs, one per chunk where the key is the corresponding range bytes. In case you don't want multiple URLs in the response, you can use + /// OSS signed URL functionality , with the public-resource-fallback query parameter set to true. + /// Note: While this endpoint does not support range headers, the returned URL(s) can be used for ranged downloads. This way, downloads can be + /// parallelized using multiple ranges for maximum speed. + /// + /// {String} bucket key (will be URL-encoded automatically) + /// {Object} body parameter + /// {Object[]} An array of objects representing each request to get an S3 URL to download from. + /// {String} Object name to create a download S3 signed URL for + /// {String=} Value of the Content-Type header that the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {String=} Value of the Content Disposition header the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {String=} Value of the Cache-Control header that the client expects to receive. + /// If this attribute is not provided, it defaults to the value corresponding to the object. + /// {String=} The value of this attribute is compared to the ETAG of the object. + /// If they match, the response body will show the status of this item as "skipped" with the reason as "Not modified". + /// {Date=} If the requested object has not been modified since the time specified in this attribute, + /// the response body will show the status of this item as "skipped" with the reason as "Not modified". + /// {Object=} Optional parameters + /// {Boolean=false} (public-resource-fallback) Allows fallback to OSS signed URLs in case of unmerged resumable uploads. + /// {Boolean=true} Will generate a CloudFront URL for the S3 object. + /// {Integer=2} The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-batchsigneds3download-POST/ + /// Task of ApiResponse (dynamic) + public async System.Threading.Tasks.Task> getS3DownloadURLsAsyncWithHttpInfo (string bucketKey, PostBatchSignedS3DownloadPayload body, Dictionary opts = null) { + // verify the required parameter 'bucketKey' is set + if ( String.IsNullOrEmpty (bucketKey) ) + throw new ApiException (400, "Missing the required parameter 'bucketKey' when calling getS3DownloadURLsAsyncWithHttpInfo"); + // verify the required parameter 'body' is set + if ( body == null ) + throw new ApiException (400, "Missing the required parameter 'body' when calling getS3DownloadURLsAsyncWithHttpInfo"); + if ( body.requests == null || body.requests.Count == 0 ) + throw new ApiException (400, "Missing the required parameter 'body.requests' when calling getS3DownloadURLsAsyncWithHttpInfo"); + foreach ( var item in body.requests ) { + if ( String.IsNullOrEmpty (item.objectKey) ) + throw new ApiException (400, "Missing the required parameter 'body.requests[].objectKey' when calling getS3DownloadURLsAsyncWithHttpInfo"); + } + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects/batchsigneds3download"; + var localVarPathParams = new Dictionary (); + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + + var localVarQueryParams = Opts2Dictionary ( + opts, + new Dictionary () { + { "public-resource-fallback", "public-resource-fallback" }, + { "publicResourceFallback", "public-resource-fallback" }, + { "useCdn", "useCdn" }, + { "minutesExpiration", "minutesExpiration" } + } + ); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + + Object localVarPostBody = null; + if ( body != null && body.GetType () == typeof (byte []) ) { // http body (model) parameter + localVarPostBody = body; // byte array + } else if ( body != null + && (body.GetType () == typeof (System.IO.FileStream) + || body.GetType () == typeof (System.IO.BinaryReader) + || body.GetType () == typeof (System.IO.BufferedStream) + || body.GetType () == typeof (System.IO.MemoryStream) + || body.GetType () == typeof (System.IO.StreamReader) + ) + ) { + localVarPostBody = Configuration.ApiClient.toByteArray (body); // byte array + } else if ( body != null ) { + localVarPostBody = Configuration.ApiClient.Serialize (body); + } + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( !String.IsNullOrEmpty (localVarHttpHeaderAccept) ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync ( + localVarPath, Method.Post, + localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType + ); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("getS3DownloadURLsAsyncWithHttpInfo", localVarResponse); + if ( exception != null ) + throw exception; + } + + return (new ApiResponse ( + localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + Configuration.ApiClient.Deserialize (localVarResponse, null) + )); + } + + /// Requests an S3 signed URL with which to upload an object, or an array of signed URLs with which to upload an object in multiple parts. + /// {String} bucket key (will be URL-encoded automatically) + /// {String} object key (will be URL-encoded automatically) + /// {Object=} Optional parameters + /// {String=} Get a new set of signed urls if the ones that were generated before have already expired and the user + /// still needs to upload some of them. + /// {Integer=} For a multipart upload, is the starting index when getting upload part URL. + /// If this parameter is not specified the default value is firstPart = 1. + /// Example: To retrieve the parts from 10 to 15 you should pass firstPart = 10 and parts = 6, this will retrieve the parts 10, 11, 12, 13, 14 and 15. + /// {Integer=} For a multipart upload, is the starting index when getting upload part URL. + /// If this parameter is not specified the default value is firstPart = 1. + /// Example: To retrieve the parts from 10 to 15 you should pass firstPart = 10 and parts = 6, this will retrieve the parts 10, 11, 12, 13, 14 and 15. + /// + /// {Boolean=true} Whether or not to generate an accelerated signed URL (ie: URLs of + /// the form …s3-accelerate.amazonaws.com… vs …s3.amazonaws.com…). + /// When not specified, defaults to true. Providing non-boolean values will result in a 400 error. + /// {Integer=2} The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectKey-signeds3upload-GET/ + /// Task of ApiResponse (dynamic) + public async System.Threading.Tasks.Task getS3UploadURLAsync (string bucketKey, string objectKey, Dictionary opts = null) { + ApiResponse localVarResponse = await getS3UploadURLAsyncWithHttpInfo (bucketKey, objectKey, opts); + return (localVarResponse.Data); + } + + /// Requests an S3 signed URL with which to upload an object, or an array of signed URLs with which to upload an object in multiple parts. + /// {String} bucket key (will be URL-encoded automatically) + /// {String} object key (will be URL-encoded automatically) + /// {Object=} Optional parameters + /// {String=} Get a new set of signed urls if the ones that were generated before have already expired and the user + /// still needs to upload some of them. + /// {Integer=} For a multipart upload, is the starting index when getting upload part URL. + /// If this parameter is not specified the default value is firstPart = 1. + /// Example: To retrieve the parts from 10 to 15 you should pass firstPart = 10 and parts = 6, this will retrieve the parts 10, 11, 12, 13, 14 and 15. + /// {Integer=} For a multipart upload, is the starting index when getting upload part URL. + /// If this parameter is not specified the default value is firstPart = 1. + /// Example: To retrieve the parts from 10 to 15 you should pass firstPart = 10 and parts = 6, this will retrieve the parts 10, 11, 12, 13, 14 and 15. + /// + /// {Boolean=true} Whether or not to generate an accelerated signed URL (ie: URLs of + /// the form …s3-accelerate.amazonaws.com… vs …s3.amazonaws.com…). + /// When not specified, defaults to true. Providing non-boolean values will result in a 400 error. + /// {Integer=2} The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectKey-signeds3upload-GET/ + /// Task of ApiResponse (dynamic) + public async System.Threading.Tasks.Task> getS3UploadURLAsyncWithHttpInfo (string bucketKey, string objectKey, Dictionary opts = null) { + // verify the required parameter 'bucketKey' is set + if ( String.IsNullOrEmpty (bucketKey) ) + throw new ApiException (400, "Missing the required parameter 'bucketKey' when calling getS3UploadURLAsyncWithHttpInfo"); + // verify the required parameter 'objectKey' is set + if ( String.IsNullOrEmpty (objectKey) ) + throw new ApiException (400, "Missing the required parameter 'objectKey' when calling getS3UploadURLAsyncWithHttpInfo"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects/{objectKey}/signeds3upload"; + var localVarPathParams = new Dictionary (); + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + localVarPathParams.Add ("objectKey", Configuration.ApiClient.ParameterToString (objectKey)); // path parameter + var localVarQueryParams = Opts2Dictionary ( + opts, + new Dictionary () { + { "uploadKey", "uploadKey" }, + { "firstPart", "firstPart" }, + { "parts", "parts" }, + { "useAcceleration", "useAcceleration" }, + { "minutesExpiration", "minutesExpiration" } + } + ); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = null; + + // to determine the Content-Type header + //String [] localVarHttpContentTypes = new String [] { + // contentType + //}; + //String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + String localVarHttpContentType = null; + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( !String.IsNullOrEmpty (localVarHttpHeaderAccept) ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync ( + localVarPath, Method.Get, + localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType + ); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("getS3UploadURLAsyncWithHttpInfo", localVarResponse); + if ( exception != null ) + throw exception; + } + + return (new ApiResponse ( + localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + Configuration.ApiClient.Deserialize (localVarResponse, null) + )); + } + + /// Instructs OSS to complete the object creation process after the bytes have been uploaded directly to S3. + /// {String} bucket key (will be URL-encoded automatically) + /// {String} object key (will be URL-encoded automatically) + /// {Object} + /// {String} The identifier of the upload session, which was provided by OSS in the response to the Get Upload URL/s request. + /// {Integer=} The expected size of the uploaded object. If provided, OSS will check this against the blob in S3 and return + /// an error if the size does not match. + /// {List=} An array of eTags. S3 returns an eTag to each upload request, be it for a chunk or an entire file. + /// For a single-part upload, this array contains the expected eTag of the entire object. For a multipart upload, this array contains the expected + /// eTag of each part of the upload; the index of an eTag in the array corresponds to its part number in the upload. If provided, OSS will validate + /// these eTags against the content in S3, and return an error if the eTags do not match (indicating some form of data corruption). + /// {Object=} Optional parameters + /// {String=} (x-ads-meta-Content-Type) The Content-Type value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Content-Disposition) The Content-Disposition value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Content-Encoding) The Content-Encoding value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Cache-Control) The Cache-Control value that OSS will store in the record for the uploaded object. + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectKey-signeds3upload-POST/ + /// Task of ApiResponse (dynamic) + public async System.Threading.Tasks.Task completeS3UploadAsync (string bucketKey, string objectKey, PostCompleteS3UploadPayload body, Dictionary opts = null) { + ApiResponse localVarResponse = await completeS3UploadAsyncWithHttpInfo (bucketKey, objectKey, body, opts); + return (localVarResponse.Data); + } + + /// Instructs OSS to complete the object creation process after the bytes have been uploaded directly to S3. + /// {String} bucket key (will be URL-encoded automatically) + /// {String} object key (will be URL-encoded automatically) + /// {Object} + /// {String} The identifier of the upload session, which was provided by OSS in the response to the Get Upload URL/s request. + /// {Integer=} The expected size of the uploaded object. If provided, OSS will check this against the blob in S3 and return + /// an error if the size does not match. + /// {List=} An array of eTags. S3 returns an eTag to each upload request, be it for a chunk or an entire file. + /// For a single-part upload, this array contains the expected eTag of the entire object. For a multipart upload, this array contains the expected + /// eTag of each part of the upload; the index of an eTag in the array corresponds to its part number in the upload. If provided, OSS will validate + /// these eTags against the content in S3, and return an error if the eTags do not match (indicating some form of data corruption). + /// {Object=} Optional parameters + /// {String=} (x-ads-meta-Content-Type) The Content-Type value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Content-Disposition) The Content-Disposition value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Content-Encoding) The Content-Encoding value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Cache-Control) The Cache-Control value that OSS will store in the record for the uploaded object. + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectKey-signeds3upload-POST/ + /// Task of ApiResponse (dynamic) + public async System.Threading.Tasks.Task> completeS3UploadAsyncWithHttpInfo (string bucketKey, string objectKey, PostCompleteS3UploadPayload body, Dictionary opts = null) { + // verify the required parameter 'bucketKey' is set + if ( String.IsNullOrEmpty (bucketKey) ) + throw new ApiException (400, "Missing the required parameter 'bucketKey' when calling completeS3UploadAsyncWithHttpInfo"); + // verify the required parameter 'objectKey' is set + if ( String.IsNullOrEmpty (objectKey) ) + throw new ApiException (400, "Missing the required parameter 'objectKey' when calling completeS3UploadAsyncWithHttpInfo"); + // verify the required parameter 'body' is set + if ( body == null ) + throw new ApiException (400, "Missing the required parameter 'body' when calling completeS3UploadAsyncWithHttpInfo"); + if ( body.eTags != null && body.eTags.Count == 0 ) + throw new ApiException (400, "Invalid 'body.eTags' parameter when calling completeS3UploadAsyncWithHttpInfo"); + if ( String.IsNullOrEmpty (body.uploadKey) ) + throw new ApiException (400, "Missing the required parameter 'body.uploadKey' when calling completeS3UploadAsyncWithHttpInfo"); + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects/{objectKey}/signeds3upload"; + var localVarPathParams = new Dictionary (); + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + localVarPathParams.Add ("objectKey", Configuration.ApiClient.ParameterToString (objectKey)); // path parameter + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = Opts2Dictionary ( + opts, + new Dictionary () { + { "x-ads-meta-Content-Type", "x-ads-meta-Content-Type" }, + { "x-ads-meta-Content-Disposition", "x-ads-meta-Content-Disposition" }, + { "x-ads-meta-Content-Encoding", "x-ads-meta-Content-Encoding" }, + { "x-ads-meta-Cache-Control", "x-ads-meta-Cache-Control" }, + { "xAdsMetaContentType", "x-ads-meta-Content-Type" }, + { "xAdsMetaContentDisposition", "x-ads-meta-Content-Disposition" }, + { "xAdsMetaContentEncoding", "x-ads-meta-Content-Encoding" }, + { "xAdsMetaCacheControl", "x-ads-meta-Cache-Control" } + }, + new Dictionary (Configuration.DefaultHeader) + ); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = body; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( !String.IsNullOrEmpty (localVarHttpHeaderAccept) ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync ( + localVarPath, Method.Post, + localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType + ); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("completeS3UploadAsyncWithHttpInfo", localVarResponse); + if ( exception != null ) + throw exception; + } + + return (new ApiResponse ( + localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + Configuration.ApiClient.Deserialize (localVarResponse, null) + )); + } + + /// Instructs OSS to complete the object creation process for numerous objects after their bytes have been uploaded directly to S3. + /// {String} bucket key (will be URL-encoded automatically) + /// {Object} body parameter + /// {Object[]} An array of objects representing each request to get an S3 URL to download from. + /// {String} The key/name of the object for which to complete an upload. + /// {String} The identifier of the upload session, which was provided by OSS in the response to the Get Upload URL/s request. + /// {Integer=} The expected size of the uploaded object. If provided, OSS will check this against the blob in S3 and return + /// an error if the size does not match. + /// {String[]=} An array of eTags. S3 returns an eTag to each upload request, be it for a chunk or an entire file. + /// For a single-part upload, this array contains the expected eTag of the entire object. For a multipart upload, this array contains the expected + /// eTag of each part of the upload; the index of an eTag in the array corresponds to its part number in the upload. If provided, OSS will validate + /// these eTags against the content in S3, and return an error if the eTags do not match (indicating some form of data corruption). + /// {String=} (x-ads-meta-Content-Type) The Content-Type value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Content-Disposition) The Content-Disposition value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Content-Encoding) The Content-Encoding value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Cache-Control) The Cache-Control value that OSS will store in the record for the uploaded object. + /// {Object=} Optional parameters + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectKey-batchcompleteupload-POST/ + /// Task of ApiResponse (dynamic) + public async System.Threading.Tasks.Task completeS3UploadsAsync (string bucketKey, PostBatchCompleteS3UploadPayload body, Dictionary opts = null) { + ApiResponse localVarResponse = await completeS3UploadsAsyncWithHttpInfo (bucketKey, body, opts); + return (localVarResponse.Data); + } + + /// Instructs OSS to complete the object creation process for numerous objects after their bytes have been uploaded directly to S3. + /// {String} bucket key (will be URL-encoded automatically) + /// {Object} body parameter + /// {Object[]} An array of objects representing each request to get an S3 URL to download from. + /// {String} The key/name of the object for which to complete an upload. + /// {String} The identifier of the upload session, which was provided by OSS in the response to the Get Upload URL/s request. + /// {Integer=} The expected size of the uploaded object. If provided, OSS will check this against the blob in S3 and return + /// an error if the size does not match. + /// {String[]=} An array of eTags. S3 returns an eTag to each upload request, be it for a chunk or an entire file. + /// For a single-part upload, this array contains the expected eTag of the entire object. For a multipart upload, this array contains the expected + /// eTag of each part of the upload; the index of an eTag in the array corresponds to its part number in the upload. If provided, OSS will validate + /// these eTags against the content in S3, and return an error if the eTags do not match (indicating some form of data corruption). + /// {String=} (x-ads-meta-Content-Type) The Content-Type value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Content-Disposition) The Content-Disposition value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Content-Encoding) The Content-Encoding value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Cache-Control) The Cache-Control value that OSS will store in the record for the uploaded object. + /// {Object=} Optional parameters + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectKey-batchcompleteupload-POST/ + /// Task of ApiResponse (dynamic) + public async System.Threading.Tasks.Task> completeS3UploadsAsyncWithHttpInfo (string bucketKey, PostBatchCompleteS3UploadPayload body, Dictionary opts = null) { + // verify the required parameter 'bucketKey' is set + if ( String.IsNullOrEmpty (bucketKey) ) + throw new ApiException (400, "Missing the required parameter 'bucketKey' when calling completeS3UploadsAsyncWithHttpInfo"); + // verify the required parameter 'body' is set + if ( body == null ) + throw new ApiException (400, "Missing the required parameter 'body' when calling completeS3UploadsAsyncWithHttpInfo"); + if ( body.requests == null || body.requests.Count == 0 ) + throw new ApiException (400, "Missing the required parameter 'body.requests' when calling completeS3UploadsAsyncWithHttpInfo"); + for ( int i = 0 ; i < body.requests.Count ; i++ ) { + if ( String.IsNullOrEmpty (body.requests [i].objectKey) ) + throw new ApiException (400, "Missing the required parameter 'body.requests[].objectKey' when calling completeS3UploadsAsyncWithHttpInfo"); + if ( String.IsNullOrEmpty (body.requests [i].uploadKey) ) + throw new ApiException (400, "Missing the required parameter 'body.requests[].uploadKey' when calling completeS3UploadsAsyncWithHttpInfo"); + if ( body.requests [i].eTags != null && body.requests [i].eTags.Count == 0 ) + throw new ApiException (400, "Invalid 'body.requests[i].eTags' parameter when calling completeS3UploadsAsyncWithHttpInfo"); + } + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects/batchcompleteupload"; + var localVarPathParams = new Dictionary (); + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + var localVarQueryParams = new Dictionary (); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = body; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( !String.IsNullOrEmpty (localVarHttpHeaderAccept) ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync ( + localVarPath, Method.Post, + localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType + ); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("completeS3UploadsAsyncWithHttpInfo", localVarResponse); + if ( exception != null ) + throw exception; + } + + return (new ApiResponse ( + localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + Configuration.ApiClient.Deserialize (localVarResponse, null) + )); + } + + /// Requests a batch of S3 signed URL with which to upload multiple objects or chunks of multiple objects. + /// {String} bucket key (will be URL-encoded automatically) + /// {Object} body parameter + /// {Object[]} An array of objects representing each request to get an S3 URL to download from. + /// {String} The key/name of the object for which to create an S3 upload URL. If neither the "part" nor "parts" + /// attribute is provided, OSS will return a single upload URL with which to upload the entire object. + /// {String=} Get a new set of signed urls if the ones that were generated before have already expired and the user + /// still needs to upload some of them. + /// {Integer=} For a multipart upload, is the starting index when getting upload part URL. + /// If this parameter is not specified the default value is firstPart = 1. + /// Example: To retrieve the parts from 10 to 15 you should pass firstPart = 10 and parts = 6, this will retrieve the parts 10, 11, 12, 13, 14 and 15. + /// @param {Integer=} [body.requests[].parts=1] For a multipart upload, is the starting index when getting upload part URL. + /// If this parameter is not specified the default value is firstPart = 1. + /// Example: To retrieve the parts from 10 to 15 you should pass firstPart = 10 and parts = 6, this will retrieve the parts 10, 11, 12, 13, 14 and 15. + /// {Object=} Optional parameters + /// {Boolean=true} Whether or not to generate an accelerated signed URL (ie: URLs of + /// the form …s3-accelerate.amazonaws.com… vs …s3.amazonaws.com…). + /// When not specified, defaults to true. Providing non-boolean values will result in a 400 error. + /// {Integer=2} The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectKey-batchsigneds3upload-POST/ + /// Task of ApiResponse (dynamic) + public async System.Threading.Tasks.Task getS3UploadURLsAsync (string bucketKey, PostBatchSignedS3UploadPayload body, Dictionary opts = null) { + ApiResponse localVarResponse = await getS3UploadURLsAsyncWithHttpInfo (bucketKey, body, opts); + return (localVarResponse.Data); + } + + /// Requests a batch of S3 signed URL with which to upload multiple objects or chunks of multiple objects. + /// {String} bucket key (will be URL-encoded automatically) + /// {Object} body parameter + /// {Object[]} An array of objects representing each request to get an S3 URL to download from. + /// {String} The key/name of the object for which to create an S3 upload URL. If neither the "part" nor "parts" + /// attribute is provided, OSS will return a single upload URL with which to upload the entire object. + /// {String=} Get a new set of signed urls if the ones that were generated before have already expired and the user + /// still needs to upload some of them. + /// {Integer=} For a multipart upload, is the starting index when getting upload part URL. + /// If this parameter is not specified the default value is firstPart = 1. + /// Example: To retrieve the parts from 10 to 15 you should pass firstPart = 10 and parts = 6, this will retrieve the parts 10, 11, 12, 13, 14 and 15. + /// @param {Integer=} [body.requests[].parts=1] For a multipart upload, is the starting index when getting upload part URL. + /// If this parameter is not specified the default value is firstPart = 1. + /// Example: To retrieve the parts from 10 to 15 you should pass firstPart = 10 and parts = 6, this will retrieve the parts 10, 11, 12, 13, 14 and 15. + /// {Object=} Optional parameters + /// {Boolean=true} Whether or not to generate an accelerated signed URL (ie: URLs of + /// the form …s3-accelerate.amazonaws.com… vs …s3.amazonaws.com…). + /// When not specified, defaults to true. Providing non-boolean values will result in a 400 error. + /// {Integer=2} The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. + /// https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectKey-batchsigneds3upload-POST/ + /// Task of ApiResponse (dynamic) + public async System.Threading.Tasks.Task> getS3UploadURLsAsyncWithHttpInfo (string bucketKey, PostBatchSignedS3UploadPayload body, Dictionary opts = null) { + // verify the required parameter 'bucketKey' is set + if ( String.IsNullOrEmpty (bucketKey) ) + throw new ApiException (400, "Missing the required parameter 'bucketKey' when calling getS3UploadURLsAsyncWithHttpInfo"); + // verify the required parameter 'body' is set + if ( body == null ) + throw new ApiException (400, "Missing the required parameter 'body' when calling getS3UploadURLsAsyncWithHttpInfo"); + if ( body.requests == null || body.requests.Count == 0 ) + throw new ApiException (400, "Missing the required parameter 'body.requests' when calling getS3UploadURLsAsyncWithHttpInfo"); + for ( int i = 0 ; i < body.requests.Count ; i++ ) { + if ( String.IsNullOrEmpty (body.requests [i].objectKey) ) + throw new ApiException (400, "Missing the required parameter 'body.requests[].objectKey' when calling getS3UploadURLsAsyncWithHttpInfo"); + } + + var localVarPath = "/oss/v2/buckets/{bucketKey}/objects/batchsigneds3upload"; + var localVarPathParams = new Dictionary (); + localVarPathParams.Add ("bucketKey", Configuration.ApiClient.ParameterToString (bucketKey)); // path parameter + var localVarQueryParams = Opts2Dictionary ( + opts, + new Dictionary () { + { "useAcceleration", "useAcceleration" }, + { "minutesExpiration", "minutesExpiration" } + } + ); + var localVarHeaderParams = new Dictionary (Configuration.DefaultHeader); + var localVarFormParams = new Dictionary (); + var localVarFileParams = new Dictionary (); + Object localVarPostBody = body; + + // to determine the Content-Type header + String [] localVarHttpContentTypes = new String [] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType (localVarHttpContentTypes); + + // to determine the Accept header + String [] localVarHttpHeaderAccepts = new String [] { + "application/vnd.api+json", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept (localVarHttpHeaderAccepts); + if ( !String.IsNullOrEmpty (localVarHttpHeaderAccept) ) + localVarHeaderParams.Add ("Accept", localVarHttpHeaderAccept); + + // authentication (oauth2_application) required + // oauth required + if ( !String.IsNullOrEmpty (Configuration.AccessToken) ) + localVarHeaderParams ["Authorization"] = "Bearer " + Configuration.AccessToken; + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync ( + localVarPath, Method.Post, + localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType + ); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if ( ExceptionFactory != null ) { + Exception exception = ExceptionFactory ("getS3UploadURLsAsyncWithHttpInfo", localVarResponse); + if ( exception != null ) + throw exception; + } + + return (new ApiResponse ( + localVarStatusCode, + localVarResponse.Headers.ToDictionary (x => x.Name, x => x.Value.ToString ()), + Configuration.ApiClient.Deserialize (localVarResponse, null) + )); + } + + // Workflow implementations + + /// Download a resource. + /// {String} bucket key (will be URL-encoded automatically) + /// {Object|Object[]} Object or Object array of resource to uplaod with their parameters + /// {String} object key + /// {String} Resource to upload + /// If String, it is the expected response type (defaults to json) ['arraybuffer', 'document', 'json', 'text', 'stream'] + /// If you 'stream', you need to provide a writable stream ('data'), the method will pipe content into it. + /// {Object=} Optional parameters + /// {Boolean=false} Allows fallback to OSS signed URLs in case of unmerged resumable uploads. + /// {Boolean=true} Will generate a CloudFront URL for the S3 object. + /// {Integer=2} The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. + /// {Integer=0} Chunk size in Mb. Should not be below 5Mb. Default is 0, download file in one piece. + /// {DownloadItemsCallBack} (progressEvent) => {} + /// {RefreshTokenCallBack} () => {} + /// Task of ApiResponse (dynamic[]) + public async System.Threading.Tasks.Task> downloadResources (string bucketKey, List objects, Dictionary opts = null, DownloadItemsCallBack onDownloadProgress = null, RefreshTokenCallBack onRefreshToken = null) { + if ( String.IsNullOrEmpty (bucketKey) ) + throw new ApiException (400, "Missing the required parameter 'bucketKey' when calling downloadResources"); + if ( objects == null ) + throw new ApiException (400, "Missing the required parameter 'objects' when calling downloadResources"); + for ( int i = 0 ; i < objects.Count ; i++ ) { + if ( String.IsNullOrEmpty (objects [i].objectKey) ) + throw new ApiException (400, "Missing the required parameter 'objects[].objectKey' when calling downloadResources"); + if ( String.IsNullOrEmpty (objects [i].responseType) ) + throw new ApiException (400, "Missing the required parameter 'objects[].responseType' when calling downloadResources"); + //if ( objects [i].responseType == "stream" && (objects [i].data == null || objects [i].data.CanWrite == false) ) + // throw new ApiException (400, "Missing the required parameter 'objects[].data' when calling downloadResources with responseType == 'stream'"); + } + if ( opts == null ) + opts = new Dictionary (); + var _this = this; + + async System.Threading.Tasks.Task requestSize (string _bucketKey, List _objects) { + try { + if ( _this.Configuration.Bearer.isAboutToExpire () && onRefreshToken != null ) { + Bearer bearer = await onRefreshToken (); + if ( bearer != null ) + _this.Configuration.Bearer = bearer; + } + PostBatchSignedS3DownloadPayload payload = new PostBatchSignedS3DownloadPayload (); + foreach ( DownloadItemDesc entry in _objects ) + payload.requests.Add (new PostBatchSignedS3DownloadPayloadItem (entry.objectKey)); + dynamic downloadParams = await _this.getS3DownloadURLsAsync ( + _bucketKey, + payload, + opts + ); // Automatically retries 429 and 500-599 responses + + DynamicDictionary results = downloadParams ["results"]; + //long size = 0; + //foreach ( var item in results.Items () ) { + // var tt = item.Value as dynamic; + // var gg = tt ["size"]; + // if ( tt ["status"] == "complete" ) + // size += tt ["size"]; + //} + long size = results.Items ().Sum (x => (x.Value as dynamic) ["status"] == "complete" ? (long)((x.Value as dynamic) ["size"]) : 0); + return (size); + } catch ( Exception ex ) { + Debug.WriteLine (ex.Message); + } + return (0); + } + + async System.Threading.Tasks.Task requestURL (string _bucketKey, DownloadItemDesc record) { + try { + if ( _this.Configuration.Bearer.isAboutToExpire () && onRefreshToken != null ) { + Bearer bearer = await onRefreshToken (); + if ( bearer != null ) + _this.Configuration.Bearer = bearer; + } + record.downloadParams = await _this.getS3DownloadURLsAsync ( + _bucketKey, + new PostBatchSignedS3DownloadPayload ( + new PostBatchSignedS3DownloadPayloadItem (record.objectKey, "application/octet-stream") + ), + opts + ); // Automatically retries 429 and 500-599 responses + if ( record.downloadParams ["results"] [record.objectKey] ["status"] == "complete" ) + record.downloadUrl = record.downloadParams ["results"] [record.objectKey] ["url"]; + else + record.Error = true; + } catch ( Exception ex ) { + record.Error = true; + record.download = ex; + } + return (record); + } + + async System.Threading.Tasks.Task downloadData (DownloadItemDesc record) { + try { + if ( record.Error || String.IsNullOrEmpty (record.downloadUrl) ) + return (null); + + // `responseType` indicates the type of data that the server will respond with + // options are: 'arraybuffer', 'json', 'text', 'stream' (default json) + // 'stream' with response.data.pipe(__fs.createWriteStream('...')) + + string responseType = "json"; + if ( record.isStream ) + responseType = "stream"; + else if ( !String.IsNullOrEmpty (record.responseType) ) + responseType = record.responseType; + + //HttpRequestMessage request = new HttpRequestMessage (HttpMethod.Get, record.downloadUrl); + //request.Headers + // Object.keys (record).map ((key) => { + // if ( key.startsWith ('response-') ) + // headers [key.substring (9)] = record [key]; + // }); + //await httpClient.SendAsync (request); + + HttpClient httpClient = new HttpClient (); + //HttpResponseMessage response = await httpClient.GetAsync (record.downloadUrl); + HttpRequestMessage request = new HttpRequestMessage { + RequestUri = new Uri (record.downloadUrl), + Method = HttpMethod.Get + }; + if ( record.headers != null && record.headers.ContainsKey ("Range") == true ) + request.Headers.Range = record.headers ["Range"] as RangeHeaderValue; + HttpResponseMessage response = await httpClient.SendAsync (request); + + if ( response.StatusCode == System.Net.HttpStatusCode.Forbidden ) { + record.downloadUrl = null; + return (null); + } else if ( response.StatusCode == System.Net.HttpStatusCode.OK || (record.headers != null && record.headers.ContainsKey ("Range") == true && response.StatusCode == System.Net.HttpStatusCode.PartialContent) ) { + } else { + throw new ApiException (400, "Unexpected value"); + } + + switch ( responseType ) { + case "arraybuffer": + record.data = await response.Content.ReadAsByteArrayAsync (); + break; + case "json": + record.data = await response.Content.ReadAsStringAsync (); + record.data = JObject.Parse (record.data); + break; + case "text": + record.data = await response.Content.ReadAsStringAsync (); + break; + case "stream": + Stream temp = await response.Content.ReadAsStreamAsync (); + if ( record.data == null ) { + record.data = temp; + } else { + temp.Position = 0; + await temp.CopyToAsync (record.data); + } + break; + } + + return (record); + } catch ( Exception err ) { + record.Error = true; + record.download = err; + } + return (null); + } + + DateTime startTS = DateTime.Now; + if ( onDownloadProgress != null ) + onDownloadProgress (0f, TimeSpan.Zero, objects); + long totalSize = await requestSize (bucketKey, objects); + long dataRead = 0; + long ChunkSize = opts.ContainsKey ("chunkSize") ? (int)opts ["chunkSize"] << 20 : 5 << 20; + for ( int entry = 0 ; entry < objects.Count ; entry++ ) { + DownloadItemDesc record = objects [entry]; + + await requestURL (bucketKey, record); + await downloadData (record); + + dataRead += record.downloadParams ["results"] [record.objectKey] ["size"]; + record.Progress = 1.0f; + if ( onDownloadProgress != null ) + onDownloadProgress (1.0f * dataRead / totalSize, DateTime.Now - startTS, objects); + } + if ( onDownloadProgress != null ) + onDownloadProgress (1f, DateTime.Now - startTS, objects); + return (objects); + } + + /// Upload a resource. If the specified object name already exists in the bucket, the uploaded content will overwrite the existing content for the bucket name/object name combination. + /// {String} bucket key (will be URL-encoded automatically) + /// {Object|Object[]} Object or Object array of resource to upload with their parameters + /// {String} object key + /// {String|Buffer|Stream} Resource to upload (String| Buffer | Stream) + /// {String[]=} An array of eTags. S3 returns an eTag to each upload request, be it for a chunk or an entire file. + /// For a single-part upload, this array contains the expected eTag of the entire object. For a multipart upload, this array contains the expected + /// eTag of each part of the upload; the index of an eTag in the array corresponds to its part number in the upload. If provided, OSS will validate + /// these eTags against the content in S3, and return an error if the eTags do not match (indicating some form of data corruption). + /// {String=} (x-ads-meta-Content-Type) The Content-Type value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Content-Disposition) The Content-Disposition value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Content-Encoding) The Content-Encoding value that OSS will store in the record for the uploaded object. + /// {String=} (x-ads-meta-Cache-Control) The Cache-Control value that OSS will store in the record for the uploaded object. + /// {Object=} Optional parameters + /// {Integer=5} Chunk size in Mb. Should not be below 5Mb. + /// {Integer=25} Maximum batch to produces. Should not be above 25 or below 1. + /// {Boolean=true} Whether or not to generate an accelerated signed URL (ie: URLs of + /// the form …s3-accelerate.amazonaws.com… vs …s3.amazonaws.com…). + /// When not specified, defaults to true. Providing non-boolean values will result in a 400 error. + /// {Integer=2} The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. + /// {DownloadItemsCallBack} (progressEvent) => {} + /// {RefreshTokenCallBack} () => {} + /// Task of ApiResponse (dynamic[]) + public async System.Threading.Tasks.Task> uploadResources (string bucketKey, List objects, Dictionary opts = null, UploadItemsCallBack onUploadProgress = null, RefreshTokenCallBack onRefreshToken = null) { + if ( String.IsNullOrEmpty (bucketKey) ) + throw new ApiException (400, "Missing the required parameter 'bucketKey' when calling uploadResources"); + if ( objects == null ) + throw new ApiException (400, "Missing the required parameter 'objects' when calling uploadResources"); + for ( int i = 0 ; i < objects.Count ; i++ ) { + if ( String.IsNullOrEmpty (objects [i].objectKey) ) + throw new ApiException (400, "Missing the required parameter 'objects[].objectKey' when calling downloadResources"); + if ( objects [i].data == null ) + throw new ApiException (400, "Missing the required parameter 'objects[].data' when calling uploadResources"); + } + if ( opts == null ) + opts = new Dictionary (); + var _this = this; + + if ( opts != null && opts.ContainsKey ("chunkSize") && (int)opts ["chunkSize"] < 5 ) + throw new ApiException (400, "Required parameter 'opts.chunkSize' should be >= 5 when calling uploadResources"); + if ( opts != null && opts.ContainsKey ("maxBatches") && ((int)opts ["maxBatches"] < 1 || (int)opts ["maxBatches"] > 25) ) + throw new ApiException (400, "Required parameter 'opts.maxBatches' should be >= 1 and <= 25 when calling uploadResources"); + + async System.Threading.Tasks.Task requestURLs (string _bucketKey, UploadItemDesc record, int firstPart, int parts) { + try { + if ( _this.Configuration.Bearer.isAboutToExpire () && onRefreshToken != null ) { + Bearer bearer = await onRefreshToken (); + if ( bearer != null ) + _this.Configuration.Bearer = bearer; + } + dynamic uploadParams = await _this.getS3UploadURLsAsync ( + _bucketKey, + new PostBatchSignedS3UploadPayload ( + new PostBatchSignedS3UploadPayloadItem (record.objectKey, firstPart, parts, record.uploadKey) + ), + opts + ); // Automatically retries 429 and 500-599 responses + + DynamicDictionary test = uploadParams ["results"] [record.objectKey] ["urls"]; + record.uploadUrls = test.Items ().Select (x => (string)x.Value).ToList (); + if ( record.uploadKey == null ) + record.uploadKey = uploadParams ["results"] [record.objectKey] ["uploadKey"]; + } catch ( Exception ex ) { + record.Error = true; + record.uploads = ex; + } + return (record); + } + + async System.Threading.Tasks.Task completeObjects (string _bucketKey, UploadItemDesc record) { + try { + if ( _this.Configuration.Bearer.isAboutToExpire () && onRefreshToken != null ) { + Bearer bearer = await onRefreshToken (); + if ( bearer != null ) + _this.Configuration.Bearer = bearer; + } + record.completedResponse = await _this.completeS3UploadsAsync ( + _bucketKey, + new PostBatchCompleteS3UploadPayload ( + new PostBatchCompleteS3UploadPayloadItem ( + record.objectKey, + record.uploadKey, + record.Length, + record.eTags, + record.xAdsMetaContentType, + record.xAdsMetaContentDisposition, + record.xAdsMetaContentEncoding, + record.xAdsMetaCacheControl + ) + ), + opts + ); + record.chunk = null; + record.uploadUrls = null; + record.completed = record.completedResponse ["results"] [record.objectKey]; + if ( record.completed.ContainsKey ("status") && record.completed ["status"] == "error" ) + record.Error = true; + } catch ( Exception ex ) { + record.Error = true; + record.completed = ex; + } + return (record); + } + + async System.Threading.Tasks.Task uploadData (string url, UploadItemDesc record, TimeSpan _timeOut) { + try { + // `responseType` indicates the type of data that the server will respond with + // options are: 'arraybuffer', 'document', 'json', 'text', 'stream' (default json) + + HttpClient httpClient = new HttpClient (); + httpClient.Timeout = _timeOut; + Stream memStream = new MemoryStream (record.chunk); + StreamContent streamContent = new StreamContent (memStream); + HttpResponseMessage response = await httpClient.PutAsync (url, streamContent); + if ( response.StatusCode == System.Net.HttpStatusCode.Forbidden ) { + record.uploadUrls = new List (); + return (null); + } else if ( response.StatusCode == System.Net.HttpStatusCode.OK ) { + record.eTags.Add (response.Headers.ETag.Tag.Trim(new char [] { '\"' })); + } else { + throw new ApiException (400, "Unexpected value"); + } + + return (record); + } catch ( Exception err ) { + throw err; + } + //return (null); + } + + async System.Threading.Tasks.Task processChunk (string _bucketKey, UploadItemDesc record, long partsUploaded, long totalParts, long _MaxBatches, TimeSpan _timeOut) { + while ( true ) { + Debug.WriteLine ("Uploading part {0} {1} {2}/{3}", _bucketKey, record.objectKey, partsUploaded + 1, '/', totalParts); + if ( record.uploadUrls == null || record.uploadUrls.Count == 0 ) + await requestURLs (_bucketKey, record, (int)partsUploaded + 1, (int)Math.Min (totalParts - partsUploaded, _MaxBatches)); + + string url = record.uploadUrls [0]; + record.uploadUrls.RemoveAt (0); + dynamic res = await uploadData (url, record, _timeOut); + if ( res != null ) + break; + } + } + + DateTime startTS = DateTime.Now; + long totalSize = objects.Sum (f => f.Length); + long dataSent = 0; + long ChunkSize = opts.ContainsKey ("chunkSize") ? (int)opts ["chunkSize"] << 20 : 5 << 20; + long MaxBatches = opts.ContainsKey ("maxBatches") ? (int)opts ["maxBatches"] : 25; + if ( onUploadProgress != null ) + onUploadProgress (0f, TimeSpan.Zero, objects); + TimeSpan timeOut = opts.ContainsKey ("TimeOut") ? (TimeSpan)opts ["TimeOut"] : TimeSpan.FromSeconds (100); + for ( int entry = 0 ; entry < objects.Count ; entry++ ) { + UploadItemDesc record = objects [entry]; + if ( record.isStream && record.Length == 0 ) + throw new ApiException (400, "Missing parameter length for a stream object"); + long totalParts = (int)Math.Ceiling ((decimal)record.Length / ChunkSize); + record.eTags = new List ((int)totalParts); + long partsUploaded = 0; + if ( record.isStream ) { + while ( partsUploaded < totalParts ) { + //record.chunk = record.data; + long chunkSize = Math.Min ((partsUploaded + 1) * ChunkSize, record.Length) - partsUploaded * ChunkSize; + Stream readStream = record.data; + record.chunk = new byte [chunkSize]; + await readStream.ReadAsync (record.chunk, 0, (int)chunkSize); + await processChunk (bucketKey, record, partsUploaded, totalParts, MaxBatches, timeOut); + dataSent += chunkSize; + Debug.WriteLine ("Part successfully uploaded {0}", partsUploaded + 1); + partsUploaded++; + record.Progress = 1.0f * partsUploaded / totalParts; + if ( onUploadProgress != null ) + onUploadProgress (1.0f * dataSent / totalSize, DateTime.Now - startTS, objects); + } + } else { + while ( partsUploaded < totalParts ) { + //record.chunk = record.data; + long chunkSize = Math.Min ((partsUploaded + 1) * ChunkSize, record.Length) - partsUploaded * ChunkSize; + record.chunk = record.Chunk (partsUploaded * ChunkSize, chunkSize); + await processChunk (bucketKey, record, partsUploaded, totalParts, MaxBatches, timeOut); + dataSent += chunkSize; + Debug.WriteLine ("Part successfully uploaded {0}", partsUploaded + 1); + partsUploaded++; + record.Progress = 1.0f * partsUploaded / totalParts; + if ( onUploadProgress != null ) + onUploadProgress (1.0f * dataSent / totalSize, DateTime.Now - startTS, objects); + } + } + Debug.WriteLine ("Completing parts upload"); + await completeObjects (bucketKey, record); + } + if ( onUploadProgress != null ) + onUploadProgress (1.0f, DateTime.Now - startTS, objects); + return (objects); + } + + // Workflow implementations + + #endregion + + public static string calculateSHA1 (string input) { + using ( SHA1 sha1Hash = SHA1.Create () ) { + byte [] sourceBytes = System.Text.Encoding.UTF8.GetBytes (input); + byte [] hashBytes = sha1Hash.ComputeHash (sourceBytes); + string hash = BitConverter.ToString (hashBytes).Replace ("-", String.Empty).ToLower (); + return (hash); + } + } + + public static string calculateSHA1 (System.IO.Stream input) { + input.Seek (0, SeekOrigin.Begin); + using ( SHA1 sha1Hash = SHA1.Create () ) { + byte [] hashBytes = sha1Hash.ComputeHash (input); + string hash = BitConverter.ToString (hashBytes).Replace ("-", String.Empty).ToLower (); + return (hash); + } + } + + public static string calculateSHA1 (byte [] input) { + using ( SHA1 sha1Hash = SHA1.Create () ) { + byte [] hashBytes = sha1Hash.ComputeHash (input); + string hash = BitConverter.ToString (hashBytes).Replace ("-", String.Empty).ToLower(); + return (hash); + } + } + + } +} diff --git a/Autodesk.Forge/Api/TwoLeggedApi.cs b/Autodesk.Forge/Api/TwoLeggedApi.cs new file mode 100644 index 0000000..e9187f4 --- /dev/null +++ b/Autodesk.Forge/Api/TwoLeggedApi.cs @@ -0,0 +1,391 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using System.Collections.ObjectModel; +using System.Linq; +using RestSharp; +using Autodesk.Forge.Client; +using Autodesk.Forge.Model; + +namespace Autodesk.Forge +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface ITwoLeggedApi : IApiAccessor + { + #region Synchronous Operations + /// + /// POST authenticate + /// + /// + /// Get a two-legged access token by providing your app's client ID and secret. + /// + /// Thrown when fails to make API call + /// Client ID of the app + /// Client secret of the app + /// Must be ``client_credentials`` + /// Space-separated list of required scopes Note: A URL-encoded space is* ``%20``. See the* `Scopes </en/docs/oauth/v2/overview/scopes>` *page for more information on when scopes are required. (optional) + /// Bearer + /*Bearer*/ + dynamic Authenticate(string clientId, string clientSecret, string grantType, Scope[] scope = null); + + /// + /// POST authenticate + /// + /// + /// Get a two-legged access token by providing your app's client ID and secret. + /// + /// Thrown when fails to make API call + /// Client ID of the app + /// Client secret of the app + /// Must be ``client_credentials`` + /// Space-separated list of required scopes Note: A URL-encoded space is* ``%20``. See the* `Scopes </en/docs/oauth/v2/overview/scopes>` *page for more information on when scopes are required. (optional) + /// ApiResponse of Bearer + ApiResponse AuthenticateWithHttpInfo(string clientId, string clientSecret, string grantType, Scope[] scope = null); + #endregion Synchronous Operations + #region Asynchronous Operations + /// + /// POST authenticate + /// + /// + /// Get a two-legged access token by providing your app's client ID and secret. + /// + /// Thrown when fails to make API call + /// Client ID of the app + /// Client secret of the app + /// Must be ``client_credentials`` + /// Space-separated list of required scopes Note: A URL-encoded space is* ``%20``. See the* `Scopes </en/docs/oauth/v2/overview/scopes>` *page for more information on when scopes are required. (optional) + /// Task of Bearer + System.Threading.Tasks.Task AuthenticateAsync(string clientId, string clientSecret, string grantType, Scope[] scope = null); + + /// + /// POST authenticate + /// + /// + /// Get a two-legged access token by providing your app's client ID and secret. + /// + /// Thrown when fails to make API call + /// Client ID of the app + /// Client secret of the app + /// Must be ``client_credentials`` + /// Space-separated list of required scopes Note: A URL-encoded space is* ``%20``. See the* `Scopes </en/docs/oauth/v2/overview/scopes>` *page for more information on when scopes are required. (optional) + /// Task of ApiResponse (Bearer) + System.Threading.Tasks.Task> AuthenticateAsyncWithHttpInfo(string clientId, string clientSecret, string grantType, Scope[] scope = null); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class TwoLeggedApi : ITwoLeggedApi + { + private Autodesk.Forge.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public TwoLeggedApi(String basePath) + { + this.Configuration = new Configuration(new ApiClient(basePath)); + + ExceptionFactory = Autodesk.Forge.Client.Configuration.DefaultExceptionFactory; + + // ensure API client has configuration ready + if (Configuration.ApiClient.Configuration == null) + { + this.Configuration.ApiClient.Configuration = this.Configuration; + } + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public TwoLeggedApi(Configuration configuration = null) + { + if (configuration == null) // use the default one in Configuration + this.Configuration = Configuration.Default; + else + this.Configuration = configuration; + + ExceptionFactory = Autodesk.Forge.Client.Configuration.DefaultExceptionFactory; + + // ensure API client has configuration ready + if (Configuration.ApiClient.Configuration == null) + { + this.Configuration.ApiClient.Configuration = this.Configuration; + } + } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath() + { + return this.Configuration.ApiClient.RestClient.Options.BaseUrl.ToString(); + } + + /// + /// Sets the base path of the API client. + /// + /// The base path + [Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")] + public void SetBasePath(String basePath) + { + // do nothing + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Configuration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Autodesk.Forge.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Gets the default header. + /// + /// Dictionary of HTTP header + [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] + public Dictionary DefaultHeader() + { + return this.Configuration.DefaultHeader; + } + + /// + /// Add default header. + /// + /// Header field name. + /// Header field value. + /// + [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")] + public void AddDefaultHeader(string key, string value) + { + this.Configuration.AddDefaultHeader(key, value); + } + + /// + /// POST authenticate Get a two-legged access token by providing your app's client ID and secret. + /// + /// Thrown when fails to make API call + /// Client ID of the app + /// Client secret of the app + /// Must be ``client_credentials`` + /// Space-separated list of required scopes Note: A URL-encoded space is* ``%20``. See the* `Scopes </en/docs/oauth/v2/overview/scopes>` *page for more information on when scopes are required. (optional) + /// Bearer + public /*Bearer*/dynamic Authenticate(string clientId, string clientSecret, string grantType, Scope[] scope = null) + { + ApiResponse localVarResponse = AuthenticateWithHttpInfo(clientId, clientSecret, grantType, scope); + return localVarResponse.Data; + } + + /// + /// POST authenticate Get a two-legged access token by providing your app's client ID and secret. + /// + /// Thrown when fails to make API call + /// Client ID of the app + /// Client secret of the app + /// Must be ``client_credentials`` + /// Space-separated list of required scopes Note: A URL-encoded space is* ``%20``. See the* `Scopes </en/docs/oauth/v2/overview/scopes>` *page for more information on when scopes are required. (optional) + /// ApiResponse of Bearer + public ApiResponse< /*Bearer*/dynamic> AuthenticateWithHttpInfo(string clientId, string clientSecret, string grantType, Scope[] scope = null) + { + // verify the required parameter 'clientId' is set + if (clientId == null) + throw new ApiException(400, "Missing required parameter 'clientId' when calling TwoLeggedApi->Authenticate"); + // verify the required parameter 'clientSecret' is set + if (clientSecret == null) + throw new ApiException(400, "Missing required parameter 'clientSecret' when calling TwoLeggedApi->Authenticate"); + // verify the required parameter 'grantType' is set + if (grantType == null) + throw new ApiException(400, "Missing required parameter 'grantType' when calling TwoLeggedApi->Authenticate"); + + var localVarPath = "/authentication/v2/token"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/x-www-form-urlencoded" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + String localVarAuthorizationHeader = Configuration.ApiClient.SetAuthorizationHeader(client_id: clientId, client_secret: clientSecret); + + if (localVarAuthorizationHeader != null) + localVarHeaderParams.Add("Authorization", localVarAuthorizationHeader); + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add("format", "json"); + if (grantType != null) localVarFormParams.Add("grant_type", Configuration.ApiClient.ParameterToString(grantType)); // form parameter + if (scope != null) localVarFormParams.Add("scope", Configuration.ApiClient.ParameterToString(scope.AsString())); // form parameter + + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)Configuration.ApiClient.CallApi(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("Authenticate", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + /*(Bearer)*/ Configuration.ApiClient.Deserialize(localVarResponse, typeof(Bearer))); + + } + + /// + /// POST authenticate Get a two-legged access token by providing your app's client ID and secret. + /// + /// Thrown when fails to make API call + /// Client ID of the app + /// Client secret of the app + /// Must be ``client_credentials`` + /// Space-separated list of required scopes Note: A URL-encoded space is* ``%20``. See the* `Scopes </en/docs/oauth/v2/overview/scopes>` *page for more information on when scopes are required. (optional) + /// Task of Bearer + public async System.Threading.Tasks.Task AuthenticateAsync(string clientId, string clientSecret, string grantType, Scope[] scope = null) + { + ApiResponse localVarResponse = await AuthenticateAsyncWithHttpInfo(clientId, clientSecret, grantType, scope); + return localVarResponse.Data; + + } + + /// + /// POST authenticate Get a two-legged access token by providing your app's client ID and secret. + /// + /// Thrown when fails to make API call + /// Client ID of the app + /// Client secret of the app + /// Must be ``client_credentials`` + /// Space-separated list of required scopes Note: A URL-encoded space is* ``%20``. See the* `Scopes </en/docs/oauth/v2/overview/scopes>` *page for more information on when scopes are required. (optional) + /// Task of ApiResponse (Bearer) + public async System.Threading.Tasks.Task> AuthenticateAsyncWithHttpInfo(string clientId, string clientSecret, string grantType, Scope[] scope = null) + { + // verify the required parameter 'clientId' is set + if (clientId == null) + throw new ApiException(400, "Missing required parameter 'clientId' when calling TwoLeggedApi->Authenticate"); + // verify the required parameter 'clientSecret' is set + if (clientSecret == null) + throw new ApiException(400, "Missing required parameter 'clientSecret' when calling TwoLeggedApi->Authenticate"); + // verify the required parameter 'grantType' is set + if (grantType == null) + throw new ApiException(400, "Missing required parameter 'grantType' when calling TwoLeggedApi->Authenticate"); + + var localVarPath = "/authentication/v2/token"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/x-www-form-urlencoded" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + String localVarAuthorizationHeader = Configuration.ApiClient.SetAuthorizationHeader(client_id: clientId, client_secret: clientSecret); + + if (localVarAuthorizationHeader != null) + localVarHeaderParams.Add("Authorization", localVarAuthorizationHeader); + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add("format", "json"); + if (grantType != null) localVarFormParams.Add("grant_type", Configuration.ApiClient.ParameterToString(grantType)); // form parameter + if (scope != null) localVarFormParams.Add("scope", Configuration.ApiClient.ParameterToString(scope.AsString())); // form parameter + + + // make the HTTP request + RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int)localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("Authenticate", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + /*(Bearer)*/ Configuration.ApiClient.Deserialize(localVarResponse, typeof(Bearer))); + + } + public static string Base64Encode(string text) + { + return System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(text)); + } + + } +} diff --git a/Autodesk.Forge/Autodesk.Forge.csproj b/Autodesk.Forge/Autodesk.Forge.csproj new file mode 100644 index 0000000..0f72444 --- /dev/null +++ b/Autodesk.Forge/Autodesk.Forge.csproj @@ -0,0 +1,25 @@ + + + + netstandard2.0 + latest + + + + ricaun.Autodesk.Forge + 3.0.0 + + + + $(OutputPath)\$(AssemblyName).xml + CS1570;CS1571;CS1572;CS1573;CS1591 + + + + + + + + + + diff --git a/Autodesk.Forge/Client/ApiClient.cs b/Autodesk.Forge/Client/ApiClient.cs new file mode 100644 index 0000000..0b5fb2d --- /dev/null +++ b/Autodesk.Forge/Client/ApiClient.cs @@ -0,0 +1,560 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Text.RegularExpressions; +using System.IO; +using System.Web; +using System.Linq; +using System.Net; +using System.Text; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using RestSharp; +using Autodesk.Forge.Model; + +namespace Autodesk.Forge.Client +{ + /// + /// API client is mainly responsible for making the HTTP call to the API backend. + /// + public partial class ApiClient + { + private JsonSerializerSettings serializerSettings = new JsonSerializerSettings + { + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor + }; + + /// + /// Allows for extending request processing for generated code. + /// + /// The RestSharp request object + partial void InterceptRequest(RestRequest request); + + /// + /// Allows for extending response processing for generated code. + /// + /// The RestSharp request object + /// The RestSharp response object + partial void InterceptResponse(RestRequest request, RestResponse response); + + /// + /// Initializes a new instance of the class + /// with default configuration and base path (https://developer.api.autodesk.com/). + /// + public ApiClient() + { + Configuration = Configuration.Default; + var options = new RestClientOptions("https://developer.api.autodesk.com/") + { + // set timeout + Timeout = TimeSpan.FromMilliseconds(Configuration.DefaultTimeout), + // set user agent + UserAgent = Configuration.DefaultUserAgent + }; + RestClient = new RestClient(options); + } + + /// + /// Initializes a new instance of the class + /// with default base path (https://developer.api.autodesk.com/). + /// + /// An instance of Configuration. + public ApiClient(Configuration config = null) + { + if (config == null) + Configuration = Configuration.Default; + else + Configuration = config; + + var options = new RestClientOptions("https://developer.api.autodesk.com/") + { + // set timeout + Timeout = TimeSpan.FromMilliseconds(Configuration.DefaultTimeout), + // set user agent + UserAgent = Configuration.DefaultUserAgent + }; + RestClient = new RestClient(options); + } + + /// + /// Initializes a new instance of the class + /// with default configuration. + /// + /// The base path. + public ApiClient(String basePath = "https://developer.api.autodesk.com/") + { + if (String.IsNullOrEmpty(basePath)) + throw new ArgumentException("basePath cannot be empty"); + + var options = new RestClientOptions(basePath) + { + // set timeout + Timeout = TimeSpan.FromMilliseconds(Configuration.DefaultTimeout), + // set user agent + UserAgent = Configuration.DefaultUserAgent + }; + RestClient = new RestClient(options); + Configuration = Configuration.Default; + } + + /// + /// Gets or sets the default API client for making HTTP calls. + /// + /// The default API client. + [Obsolete("ApiClient.Default is deprecated, please use 'Configuration.Default.ApiClient' instead.")] + public static ApiClient Default { get; set; } + + /// + /// Gets or sets the Configuration. + /// + /// An instance of the Configuration. + public Configuration Configuration { get; set; } + + /// + /// Gets or sets the RestClient. + /// + /// An instance of the RestClient + public RestClient RestClient { get; set; } + + // Creates and sets up a RestRequest prior to a call. + private RestRequest PrepareRequest( + String path, RestSharp.Method method, Dictionary queryParams, Object postBody, + Dictionary headerParams, Dictionary formParams, + Dictionary fileParams, Dictionary pathParams, + String contentType + ) + { + var request = new RestRequest(path, method); + + // add path parameter, if any + foreach (var param in pathParams) + request.AddParameter(param.Key, param.Value, ParameterType.UrlSegment); + + // add header parameter, if any + foreach (var param in headerParams) + request.AddHeader(param.Key, param.Value); + + // add query parameter, if any + foreach (var param in queryParams) + request.AddQueryParameter(param.Key, param.Value); + + // add form parameter, if any + foreach (var param in formParams) + request.AddParameter(param.Key, param.Value); + + // add file parameter, if any + foreach (var param in fileParams) + { + request.AddFile( + param.Value.Name, + param.Value.GetFile, + param.Value.FileName, + param.Value.ContentType + ); + } + + if (postBody != null) // http body (model or byte[]) parameter + { + if (!string.IsNullOrWhiteSpace(contentType)) + { + request.AddParameter(contentType, postBody, ParameterType.RequestBody); + } + else if (postBody.GetType() == typeof(String)) + { + request.AddParameter("application/json", postBody, ParameterType.RequestBody); + } + //else if (postBody.GetType() == typeof(byte[])) + //{ + // request.AddParameter(contentType, postBody, ParameterType.RequestBody); + //} + } + + return request; + } + + /// + /// Makes the HTTP request (Sync). + /// + /// URL path. + /// HTTP method. + /// Query parameters. + /// HTTP body (POST request). + /// Header parameters. + /// Form parameters. + /// File parameters. + /// Path parameters. + /// Content Type of the request + /// Object + public Object CallApi( + String path, RestSharp.Method method, Dictionary queryParams, Object postBody, + Dictionary headerParams, Dictionary formParams, + Dictionary fileParams, Dictionary pathParams, + String contentType + ) + { + var request = PrepareRequest( + path, method, queryParams, postBody, headerParams, formParams, fileParams, + pathParams, contentType); + InterceptRequest(request); + var response = RestClient.Execute(request); + InterceptResponse(request, response); + + return (Object)response; + } + /// + /// Makes the asynchronous HTTP request. + /// + /// URL path. + /// HTTP method. + /// Query parameters. + /// HTTP body (POST request). + /// Header parameters. + /// Form parameters. + /// File parameters. + /// Path parameters. + /// Content type. + /// The Task instance. + public async System.Threading.Tasks.Task CallApiAsync( + String path, RestSharp.Method method, Dictionary queryParams, Object postBody, + Dictionary headerParams, Dictionary formParams, + Dictionary fileParams, Dictionary pathParams, + String contentType) + { + var request = PrepareRequest( + path, method, queryParams, postBody, headerParams, formParams, fileParams, + pathParams, contentType); + InterceptRequest(request); + var response = await RestClient.ExecuteAsync(request); + InterceptResponse(request, response); + return (Object)response; + } + + /// + /// Escape string (url-encoded). + /// + /// String to be escaped. + /// Escaped string. + public string EscapeString(string str) + { + return UrlEncode(str); + } + + /// + /// Create FileParameter based on Stream. + /// + /// Parameter name. + /// Input stream. + /// FileParameter. + public FileParameter ParameterToFile(string name, Stream stream) + { + if (stream is FileStream) + return FileParameter.Create(name, ReadAsBytes(stream), Path.GetFileName(((FileStream)stream).Name)); + else + return FileParameter.Create(name, ReadAsBytes(stream), "no_file_name_provided"); + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// Formatted string. + public string ParameterToString(object obj) + { + if (obj is DateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return ((DateTime)obj).ToString(Configuration.DateTimeFormat); + else if (obj is DateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return ((DateTimeOffset)obj).ToString(Configuration.DateTimeFormat); + else if (obj is IList) + { + var flattenedString = new StringBuilder(); + foreach (var param in (IList)obj) + { + if (flattenedString.Length > 0) + flattenedString.Append(","); + flattenedString.Append(param); + } + return flattenedString.ToString(); + } + else + return Convert.ToString(obj); + } + + /// + /// Deserialize the JSON string into a proper object. + /// + /// The HTTP response. + /// Object type. + /// Object representation of the JSON string. + public /*object*/dynamic Deserialize(RestResponse response, Type type, bool asType = false) + { + IReadOnlyCollection headers = response.Headers; + if (type == typeof(byte[])) // return byte array + return response.RawBytes; + + if (type == typeof(Stream)) + { + if (headers != null) + { + var filePath = String.IsNullOrEmpty(Configuration.TempFolderPath) + ? Path.GetTempPath() + : Configuration.TempFolderPath; + var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); + foreach (var header in headers) + { + var match = regex.Match(header.ToString()); + if (match.Success) + { + string fileName = filePath + SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); + File.WriteAllBytes(fileName, response.RawBytes); + return new FileStream(fileName, FileMode.Open); + } + } + } + var stream = new MemoryStream(response.RawBytes); + return stream; + } + + if (type != null && type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object + { + return DateTime.Parse(response.Content, null, System.Globalization.DateTimeStyles.RoundtripKind); + } + + if (type != null && (type == typeof(String) || type.Name.StartsWith("System.Nullable"))) // return primitive type + { + return ConvertType(response.Content, type); + } + + // at this point, it must be a model (json) + try + { + if (asType) + return JsonConvert.DeserializeObject(response.Content, type, serializerSettings); + return new DynamicJsonResponse(JObject.Parse(response.Content)); + } + catch (Exception /*e*/) + { + //throw new ApiException(500, e.Message); + return (new DynamicJsonResponse()); + } + } + + /// + /// Serialize an input (model) into JSON string + /// + /// Object. + /// JSON string. + public String Serialize(object obj) + { + try + { + return obj != null ? JsonConvert.SerializeObject(obj) : null; + } + catch (Exception e) + { + throw new ApiException(500, e.Message); + } + } + + /// + /// Convert Stream into byte[] + /// + /// Object. + /// byte[]. + public byte[] toByteArray(object obj) + { + if (obj == null) + return null; + try + { + System.IO.Stream body = obj as System.IO.Stream; + byte[] buffer = new byte[16 * 1024]; + using (System.IO.MemoryStream ms = new System.IO.MemoryStream()) + { + int read; + while ((read = body.Read(buffer, 0, buffer.Length)) > 0) + ms.Write(buffer, 0, read); + return ms.ToArray(); + } + } + catch (Exception e) + { + throw new ApiException(500, e.Message); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public String SelectHeaderContentType(String[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + if (contentTypes.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// Select the Accept header's value from the given accepts array: + /// if JSON exists in the given array, use it; + /// otherwise use all of them (joining into a string) + /// + /// The accepts array to select from. + /// The Accept header to use. + public String SelectHeaderAccept(String[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return String.Join(",", accepts); + } + + public String SetAuthorizationHeader(String client_id, String client_secret) + { + + string credentials = $"{client_id}:{client_secret}"; + string base64Credentials = Convert.ToBase64String(Encoding.UTF8.GetBytes(credentials)); + string authorizationHeader = $"Basic {base64Credentials}"; + + return authorizationHeader; + } + + /// + /// Encode string in base64 format. + /// + /// String to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Dynamically cast the object into target type. + /// Ref: http://stackoverflow.com/questions/4925718/c-dynamic-runtime-cast + /// + /// Object to be casted + /// Target type + /// Casted object + public static dynamic ConvertType(dynamic source, Type dest) + { + return Convert.ChangeType(source, dest); + } + + /// + /// Convert stream to byte array + /// Credit/Ref: http://stackoverflow.com/a/221941/677735 + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream input) + { + byte[] buffer = new byte[16 * 1024]; + using (MemoryStream ms = new MemoryStream()) + { + int read; + while ((read = input.Read(buffer, 0, buffer.Length)) > 0) + { + ms.Write(buffer, 0, read); + } + return ms.ToArray(); + } + } + + /// + /// URL encode a string + /// Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50 + /// + /// String to be URL encoded + /// Byte array + public static string UrlEncode(string input) + { + const int maxLength = 32766; + + if (input == null) + { + throw new ArgumentNullException("input"); + } + + if (input.Length <= maxLength) + { + return Uri.EscapeDataString(input); + } + + StringBuilder sb = new StringBuilder(input.Length * 2); + int index = 0; + + while (index < input.Length) + { + int length = Math.Min(input.Length - index, maxLength); + string subString = input.Substring(index, length); + + sb.Append(Uri.EscapeDataString(subString)); + index += subString.Length; + } + + return sb.ToString(); + } + + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + + if (match.Success) + { + return match.Groups[1].Value; + } + else + { + return filename; + } + } + } +} diff --git a/Autodesk.Forge/Client/ApiException.cs b/Autodesk.Forge/Client/ApiException.cs new file mode 100644 index 0000000..ea96e24 --- /dev/null +++ b/Autodesk.Forge/Client/ApiException.cs @@ -0,0 +1,72 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Autodesk.Forge.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// Gets or sets the error code (HTTP status code) + /// + /// The error code (HTTP status code). + public int ErrorCode { get; set; } + + /// + /// Gets or sets the error content (body json object) + /// + /// The error content (Http response body). + public dynamic ErrorContent { get; private set; } + + /// + /// Initializes a new instance of the class. + /// + public ApiException() {} + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + public ApiException(int errorCode, string message) : base(message) + { + this.ErrorCode = errorCode; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + /// Error content. + public ApiException(int errorCode, string message, dynamic errorContent = null) : base(message) + { + this.ErrorCode = errorCode; + this.ErrorContent = errorContent; + } + } + +} diff --git a/Autodesk.Forge/Client/ApiResponse.cs b/Autodesk.Forge/Client/ApiResponse.cs new file mode 100644 index 0000000..16f18f9 --- /dev/null +++ b/Autodesk.Forge/Client/ApiResponse.cs @@ -0,0 +1,66 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Autodesk.Forge.Client +{ + /// + /// API Response + /// + public class ApiResponse + { + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + public int StatusCode { get; private set; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public IDictionary Headers { get; private set; } + + /// + /// Gets or sets the data (parsed HTTP body) + /// + /// The data. + public T Data { get; private set; } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + public ApiResponse(int statusCode, IDictionary headers, T data) + { + this.StatusCode= statusCode; + this.Headers = headers; + this.Data = data; + } + + } + +} diff --git a/Autodesk.Forge/Client/Configuration.cs b/Autodesk.Forge/Client/Configuration.cs new file mode 100644 index 0000000..16e6957 --- /dev/null +++ b/Autodesk.Forge/Client/Configuration.cs @@ -0,0 +1,352 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk?s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Reflection; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using Autodesk.Forge.Model; + +namespace Autodesk.Forge.Client { + + /// + /// Represents a set of configuration settings + /// + public class Configuration { + + public static int DefaultTimeout = 100000; + public static string DefaultUserAgent = "forge-apis/2.0.0 (.net)"; + public const string Version = "2.000"; + + /// + /// Gets or sets the default Configuration. + /// + /// Configuration. + public static Configuration Default = new Configuration (); + + ///// + ///// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. + ///// + ///// Timeout. + //public int Timeout { + // get { return ApiClient.RestClient.Options.MaxTimeout; } + + // set { + // if ( ApiClient != null ) + // ApiClient.RestClient.Options.MaxTimeout = value; + // } + //} + + /// + /// Gets or sets the default API client for making HTTP calls. + /// + /// The API client. + public ApiClient ApiClient { get; set; } + + private Dictionary _defaultHeaderMap = new Dictionary (); + + /// + /// Gets or sets the default header. + /// + public Dictionary DefaultHeader { + get { return _defaultHeaderMap; } + + set { + _defaultHeaderMap = value; + } + } + + /// + /// Gets or sets the HTTP user agent. + /// + /// Http user agent. + public String UserAgent { get; set; } + + /// + /// Gets or sets the username (HTTP basic authentication). + /// + /// The username. + public String Username { get; set; } + + /// + /// Gets or sets the password (HTTP basic authentication). + /// + /// The password. + public String Password { get; set; } + + /// + /// Gets or sets the bearer for OAuth2 authentication. + /// + /// The bearer token. + public Bearer Bearer { get; set; } + + /// + /// Gets or sets the access token for OAuth2 authentication. + /// + /// The access token. + public String AccessToken { + get { return (this.Bearer.AccessToken); } + set { + this.Bearer.AccessToken = value; + this.Bearer.ExpiresAt = DateTimeOffset.Now.ToUnixTimeSeconds () + this.Bearer.ExpiresIn * 1000; + } + } + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + public Dictionary ApiKey = new Dictionary (); + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + public Dictionary ApiKeyPrefix = new Dictionary (); + + private const string ISO8601_DATETIME_FORMAT = "o"; + + private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + + /// + /// Initializes a new instance of the Configuration class with different settings + /// + /// Api client + /// Dictionary of default HTTP header + /// Username + /// Password + /// accessToken + /// Dictionary of API key + /// Dictionary of API key prefix + /// Temp folder path + /// DateTime format string + /// HTTP connection timeout (in milliseconds) + /// HTTP user agent + public Configuration ( + ApiClient apiClient = null, + Dictionary defaultHeader = null, + string username = null, + string password = null, + string accessToken = null, + Dictionary apiKey = null, + Dictionary apiKeyPrefix = null, + string tempFolderPath = null, + string dateTimeFormat = null, + int timeout = 0, + string userAgent = null + ) { + if ( timeout == 0 ) + timeout = DefaultTimeout; + if ( userAgent == null ) + userAgent = "forge-apis/" + Version + " (.net)"; + + setApiClientUsingDefault (apiClient); + + Bearer = new Bearer ("Bearer", 3599, "", null, null); + Username = username; + Password = password; + AccessToken = accessToken; + UserAgent = userAgent; + + if ( defaultHeader != null ) + DefaultHeader = defaultHeader; + if ( apiKey != null ) + ApiKey = apiKey; + if ( apiKeyPrefix != null ) + ApiKeyPrefix = apiKeyPrefix; + + TempFolderPath = tempFolderPath; + DateTimeFormat = dateTimeFormat; + //Timeout = timeout; + } + + /// + /// Initializes a new instance of the Configuration class. + /// + /// Api client. + public Configuration (ApiClient apiClient) { + setApiClientUsingDefault (apiClient); + } + + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => { + int status = (int)response.StatusCode; + if ( status >= 400 ) + return (new ApiException ( + status, + String.Format ("Error calling {0}: {1}", + methodName, + String.IsNullOrEmpty (response.Content) ? + response.ErrorException.Message + : response.Content + ), + response.Content + )); + if ( status == 0 ) + return (new ApiException ( + status, + String.Format ("Error calling {0}: {1}", + methodName, + response.ErrorMessage + ), + response.ErrorMessage + )); + return null; + }; + + /// + /// Set the ApiClient using Default or ApiClient instance. + /// + /// An instance of ApiClient. + /// + public void setApiClientUsingDefault (ApiClient apiClient = null) { + if ( apiClient == null ) { + if ( Default != null && Default.ApiClient == null ) + Default.ApiClient = new ApiClient (); + + ApiClient = Default != null ? Default.ApiClient : new ApiClient (); + } else { + if ( Default != null && Default.ApiClient == null ) + Default.ApiClient = apiClient; + + ApiClient = apiClient; + } + } + + /// + /// Add default header. + /// + /// Header field name. + /// Header field value. + /// + public void AddDefaultHeader (string key, string value) { + _defaultHeaderMap [key] = value; + } + + /// + /// Add Api Key Header. + /// + /// Api Key name. + /// Api Key value. + /// + public void AddApiKey (string key, string value) { + ApiKey [key] = value; + } + + /// + /// Sets the API key prefix. + /// + /// Api Key name. + /// Api Key value. + public void AddApiKeyPrefix (string key, string value) { + ApiKeyPrefix [key] = value; + } + + /// + /// Get the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + public string GetApiKeyWithPrefix (string apiKeyIdentifier) { + var apiKeyValue = ""; + ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue); + var apiKeyPrefix = ""; + if ( ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix) ) + return apiKeyPrefix + " " + apiKeyValue; + else + return apiKeyValue; + } + + private string _tempFolderPath = Path.GetTempPath (); + + /// + /// Gets or sets the temporary folder path to store the files downloaded from the server. + /// + /// Folder path. + public String TempFolderPath { + get { return _tempFolderPath; } + + set { + if ( String.IsNullOrEmpty (value) ) { + _tempFolderPath = value; + return; + } + + // create the directory if it does not exist + if ( !Directory.Exists (value) ) + Directory.CreateDirectory (value); + + // check if the path contains directory separator at the end + if ( value [value.Length - 1] == Path.DirectorySeparatorChar ) + _tempFolderPath = value; + else + _tempFolderPath = value + Path.DirectorySeparatorChar; + } + } + + /// + /// Gets or sets the the date time format used when serializing in the ApiClient + /// By default, it's set to ISO 8601 - "o", for others see: + /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx + /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx + /// No validation is done to ensure that the string you're providing is valid + /// + /// The DateTimeFormat string + public String DateTimeFormat { + get { + return _dateTimeFormat; + } + set { + if ( string.IsNullOrEmpty (value) ) { + // Never allow a blank or null string, go back to the default + _dateTimeFormat = ISO8601_DATETIME_FORMAT; + return; + } + + // Caution, no validation when you choose date time format other than ISO 8601 + // Take a look at the above links + _dateTimeFormat = value; + } + } + + /// + /// Returns a string with essential information for debugging. + /// + public static String ToDebugReport () { + String report = "C# SDK (Autodesk.Forge) Debug Report:\n"; + report += " OS: " + Environment.OSVersion + "\n"; + report += " .NET Framework Version: " + Assembly + .GetExecutingAssembly () + .GetReferencedAssemblies () + .Where (x => x.Name == "System.Core").First ().Version.ToString () + "\n"; + report += " SDK Package Version: " + Configuration.Version + "\n"; + + return report; + } + + } + +} diff --git a/Autodesk.Forge/Client/ExceptionFactory.cs b/Autodesk.Forge/Client/ExceptionFactory.cs new file mode 100644 index 0000000..52b24bb --- /dev/null +++ b/Autodesk.Forge/Client/ExceptionFactory.cs @@ -0,0 +1,36 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using RestSharp; + +namespace Autodesk.Forge.Client +{ + /// + /// A delegate to ExceptionFactory method + /// + /// Method name + /// Response + /// Exceptions + public delegate Exception ExceptionFactory(string methodName, RestResponse response); +} diff --git a/Autodesk.Forge/Client/IApiAccessor.cs b/Autodesk.Forge/Client/IApiAccessor.cs new file mode 100644 index 0000000..61d15e6 --- /dev/null +++ b/Autodesk.Forge/Client/IApiAccessor.cs @@ -0,0 +1,53 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using RestSharp; + +namespace Autodesk.Forge.Client +{ + /// + /// Represents configuration aspects required to interact with the API endpoints. + /// + public interface IApiAccessor + { + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + Configuration Configuration {get; set;} + + /// + /// Gets the base path of the API client. + /// + /// The base path + String GetBasePath(); + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + ExceptionFactory ExceptionFactory { get; set; } + } +} diff --git a/Autodesk.Forge/LICENSE b/Autodesk.Forge/LICENSE new file mode 100644 index 0000000..8dada3e --- /dev/null +++ b/Autodesk.Forge/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/Autodesk.Forge/Model/Bearer.cs b/Autodesk.Forge/Model/Bearer.cs new file mode 100644 index 0000000..67547de --- /dev/null +++ b/Autodesk.Forge/Model/Bearer.cs @@ -0,0 +1,229 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Autodesk.Forge.Client; + +namespace Autodesk.Forge.Model { + + /// + /// Bearer + /// + [DataContract] + public partial class Bearer : IEquatable { + + /// + /// Will always be Bearer + /// + /// Will always be Bearer + [DataMember (Name = "token_type", EmitDefaultValue = false)] + public string TokenType { get; set; } + + /// + /// Access token expiration time (in seconds) + /// + /// Access token expiration time (in seconds) + [DataMember (Name = "expires_in", EmitDefaultValue = false)] + public int? ExpiresIn { get; set; } + + /// + /// Access token expiration time (in seconds) + /// + /// Access token expiration time (in seconds) + [DataMember (Name = "expires_at", EmitDefaultValue = false)] + public long? ExpiresAt { get; set; } + + /// + /// The access token + /// + /// The access token + [DataMember (Name = "access_token", EmitDefaultValue = false)] + public string AccessToken { get; set; } + + /// + /// The refresh token + /// + /// The refresh token + [DataMember (Name = "refresh_token", EmitDefaultValue = false)] + public string RefreshToken { get; set; } + + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Bearer () { } + + /// + /// Initializes a new instance of the class. + /// + /// Will always be Bearer (required). + /// Access token expiration lifespan (in seconds) (required). + /// The access token (required). + /// The refresh token. + /// Access token expiration time (unix timestamp (Unix Epoch on January 1st, 1970 at UTC)) (default: calculated from ExpiresIn). + public Bearer (string TokenType = null, int? ExpiresIn = null, string AccessToken = null, string RefreshToken = null, long? ExpiresAt = null) { + // to ensure "TokenType" is required (not null) + if ( TokenType == null ) + throw new InvalidDataException ("TokenType is a required property for Bearer and cannot be null"); + this.TokenType = TokenType; + // to ensure "ExpiresIn" is required (not null) + if ( ExpiresIn == null ) + throw new InvalidDataException ("ExpiresIn is a required property for Bearer and cannot be null"); + this.ExpiresIn = ExpiresIn; + // to ensure "ExpiresAt" (not null) + this.ExpiresAt = ExpiresAt; + if ( ExpiresAt == null ) + this.ExpiresAt = DateTimeOffset.Now.ToUnixTimeSeconds () + this.ExpiresIn * 1000; + // to ensure "AccessToken" is required (not null) + if ( AccessToken == null ) + throw new InvalidDataException ("AccessToken is a required property for Bearer and cannot be null"); + this.AccessToken = AccessToken; + + this.RefreshToken = RefreshToken; + } + + public Bearer (ApiResponse bearer) { + this.TokenType = bearer.Data.token_type; + this.ExpiresIn = (int?)bearer.Data.expires_in; + this.ExpiresAt = DateTimeOffset.Now.ToUnixTimeSeconds () + this.ExpiresIn * 1000; + this.AccessToken = bearer.Data.access_token; + try { + this.RefreshToken = bearer.Data.refresh_token; + } catch (Exception) { + this.RefreshToken = null; + } + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString () { + var sb = new StringBuilder (); + sb.Append ("class Bearer {\n"); + sb.Append (" TokenType: ").Append (TokenType).Append ("\n"); + sb.Append (" ExpiresIn: ").Append (ExpiresIn).Append ("\n"); + sb.Append (" ExpiresAt: ").Append (ExpiresAt).Append ("\n"); + sb.Append (" AccessToken: ").Append (AccessToken).Append ("\n"); + sb.Append (" RefreshToken: ").Append (RefreshToken).Append ("\n"); + sb.Append ("}\n"); + return (sb.ToString ()); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson () { + return (JsonConvert.SerializeObject (this, Formatting.Indented)); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals (object obj) { + // credit: http://stackoverflow.com/a/10454552/677735 + return (this.Equals (obj as Bearer)); + } + + /// + /// Returns true if Bearer instances are equal + /// + /// Instance of Bearer to be compared + /// Boolean + public bool Equals (Bearer other) { + // credit: http://stackoverflow.com/a/10454552/677735 + if ( other == null ) + return (false); + + return ( + ( + this.TokenType == other.TokenType || + this.TokenType != null && + this.TokenType.Equals (other.TokenType) + ) && + ( + this.ExpiresIn == other.ExpiresIn || + this.ExpiresIn != null && + this.ExpiresIn.Equals (other.ExpiresIn) + ) && + ( + this.AccessToken == other.AccessToken || + this.AccessToken != null && + this.AccessToken.Equals (other.AccessToken) + ) && + ( + this.RefreshToken == other.RefreshToken || + this.RefreshToken != null && + this.RefreshToken.Equals (other.RefreshToken) + ) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode () { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if ( this.TokenType != null ) + hash = hash * 59 + this.TokenType.GetHashCode (); + if ( this.ExpiresIn != null ) + hash = hash * 59 + this.ExpiresIn.GetHashCode (); + if ( this.AccessToken != null ) + hash = hash * 59 + this.AccessToken.GetHashCode (); + if ( this.RefreshToken != null ) + hash = hash * 59 + this.RefreshToken.GetHashCode (); + return (hash); + } + } + + public bool hasExpired () { + return (this.ExpiresAt <= DateTimeOffset.Now.ToUnixTimeSeconds ()); + } + + public bool isAboutToExpire (int threadHoldInSeconds = 300 /*5 minutes*/) { + return (this.ExpiresAt - threadHoldInSeconds * 1000 < DateTimeOffset.Now.ToUnixTimeSeconds ()); + } + + public bool is3legged () { + return (!String.IsNullOrEmpty (this.RefreshToken)); + } + + } + +} diff --git a/Autodesk.Forge/Model/Bucket.cs b/Autodesk.Forge/Model/Bucket.cs new file mode 100644 index 0000000..ec565b8 --- /dev/null +++ b/Autodesk.Forge/Model/Bucket.cs @@ -0,0 +1,191 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Autodesk.Forge.Model +{ + /// + /// Bucket + /// + [DataContract] + public partial class Bucket : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// The key of the Bucket. + /// The owner of the Bucket. + /// Counts the number of views for the asset. + /// Permissions. + /// The policy key. + public Bucket(string BucketKey = null, string BucketOwner = null, string CreatedDate = null, List Permissions = null, string PolicyKey = null) + { + this.BucketKey = BucketKey; + this.BucketOwner = BucketOwner; + this.CreatedDate = CreatedDate; + this.Permissions = Permissions; + this.PolicyKey = PolicyKey; + } + + /// + /// The key of the Bucket + /// + /// The key of the Bucket + [DataMember(Name="bucketKey", EmitDefaultValue=false)] + public string BucketKey { get; set; } + /// + /// The owner of the Bucket + /// + /// The owner of the Bucket + [DataMember(Name="bucketOwner", EmitDefaultValue=false)] + public string BucketOwner { get; set; } + /// + /// Counts the number of views for the asset + /// + /// Counts the number of views for the asset + [DataMember(Name="createdDate", EmitDefaultValue=false)] + public string CreatedDate { get; set; } + /// + /// Gets or Sets Permissions + /// + [DataMember(Name="permissions", EmitDefaultValue=false)] + public List Permissions { get; set; } + /// + /// The policy key + /// + /// The policy key + [DataMember(Name="policyKey", EmitDefaultValue=false)] + public string PolicyKey { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Bucket {\n"); + sb.Append(" BucketKey: ").Append(BucketKey).Append("\n"); + sb.Append(" BucketOwner: ").Append(BucketOwner).Append("\n"); + sb.Append(" CreatedDate: ").Append(CreatedDate).Append("\n"); + sb.Append(" Permissions: ").Append(Permissions).Append("\n"); + sb.Append(" PolicyKey: ").Append(PolicyKey).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as Bucket); + } + + /// + /// Returns true if Bucket instances are equal + /// + /// Instance of Bucket to be compared + /// Boolean + public bool Equals(Bucket other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.BucketKey == other.BucketKey || + this.BucketKey != null && + this.BucketKey.Equals(other.BucketKey) + ) && + ( + this.BucketOwner == other.BucketOwner || + this.BucketOwner != null && + this.BucketOwner.Equals(other.BucketOwner) + ) && + ( + this.CreatedDate == other.CreatedDate || + this.CreatedDate != null && + this.CreatedDate.Equals(other.CreatedDate) + ) && + ( + this.Permissions == other.Permissions || + this.Permissions != null && + this.Permissions.SequenceEqual(other.Permissions) + ) && + ( + this.PolicyKey == other.PolicyKey || + this.PolicyKey != null && + this.PolicyKey.Equals(other.PolicyKey) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if (this.BucketKey != null) + hash = hash * 59 + this.BucketKey.GetHashCode(); + if (this.BucketOwner != null) + hash = hash * 59 + this.BucketOwner.GetHashCode(); + if (this.CreatedDate != null) + hash = hash * 59 + this.CreatedDate.GetHashCode(); + if (this.Permissions != null) + hash = hash * 59 + this.Permissions.GetHashCode(); + if (this.PolicyKey != null) + hash = hash * 59 + this.PolicyKey.GetHashCode(); + return hash; + } + } + } + +} + diff --git a/Autodesk.Forge/Model/BucketObjects.cs b/Autodesk.Forge/Model/BucketObjects.cs new file mode 100644 index 0000000..b551fdc --- /dev/null +++ b/Autodesk.Forge/Model/BucketObjects.cs @@ -0,0 +1,143 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Autodesk.Forge.Model +{ + /// + /// BucketObjects + /// + [DataContract] + public partial class BucketObjects : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// Items. + /// Next possible request. + public BucketObjects(List Items = null, string Next = null) + { + this.Items = Items; + this.Next = Next; + } + + /// + /// Gets or Sets Items + /// + [DataMember(Name="items", EmitDefaultValue=false)] + public List Items { get; set; } + /// + /// Next possible request + /// + /// Next possible request + [DataMember(Name="next", EmitDefaultValue=false)] + public string Next { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class BucketObjects {\n"); + sb.Append(" Items: ").Append(Items).Append("\n"); + sb.Append(" Next: ").Append(Next).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as BucketObjects); + } + + /// + /// Returns true if BucketObjects instances are equal + /// + /// Instance of BucketObjects to be compared + /// Boolean + public bool Equals(BucketObjects other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.Items == other.Items || + this.Items != null && + this.Items.SequenceEqual(other.Items) + ) && + ( + this.Next == other.Next || + this.Next != null && + this.Next.Equals(other.Next) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if (this.Items != null) + hash = hash * 59 + this.Items.GetHashCode(); + if (this.Next != null) + hash = hash * 59 + this.Next.GetHashCode(); + return hash; + } + } + } + +} + diff --git a/Autodesk.Forge/Model/Buckets.cs b/Autodesk.Forge/Model/Buckets.cs new file mode 100644 index 0000000..a40baa3 --- /dev/null +++ b/Autodesk.Forge/Model/Buckets.cs @@ -0,0 +1,165 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Autodesk.Forge.Model +{ + /// + /// Buckets + /// + [DataContract] + public partial class Buckets : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Buckets() { } + /// + /// Initializes a new instance of the class. + /// + /// Array of items representing the buckets (required). + /// Next possible request (required). + public Buckets(List Items = null, string Next = null) + { + // to ensure "Items" is required (not null) + if (Items == null) + { + throw new InvalidDataException("Items is a required property for Buckets and cannot be null"); + } + else + { + this.Items = Items; + } + // to ensure "Next" is required (not null) + if (Next == null) + { + throw new InvalidDataException("Next is a required property for Buckets and cannot be null"); + } + else + { + this.Next = Next; + } + } + + /// + /// Array of items representing the buckets + /// + /// Array of items representing the buckets + [DataMember(Name="items", EmitDefaultValue=false)] + public List Items { get; set; } + /// + /// Next possible request + /// + /// Next possible request + [DataMember(Name="next", EmitDefaultValue=false)] + public string Next { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Buckets {\n"); + sb.Append(" Items: ").Append(Items).Append("\n"); + sb.Append(" Next: ").Append(Next).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as Buckets); + } + + /// + /// Returns true if Buckets instances are equal + /// + /// Instance of Buckets to be compared + /// Boolean + public bool Equals(Buckets other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.Items == other.Items || + this.Items != null && + this.Items.SequenceEqual(other.Items) + ) && + ( + this.Next == other.Next || + this.Next != null && + this.Next.Equals(other.Next) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if (this.Items != null) + hash = hash * 59 + this.Items.GetHashCode(); + if (this.Next != null) + hash = hash * 59 + this.Next.GetHashCode(); + return hash; + } + } + } + +} + diff --git a/Autodesk.Forge/Model/BucketsItems.cs b/Autodesk.Forge/Model/BucketsItems.cs new file mode 100644 index 0000000..ddafbfa --- /dev/null +++ b/Autodesk.Forge/Model/BucketsItems.cs @@ -0,0 +1,218 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Autodesk.Forge.Model +{ + /// + /// BucketsItems + /// + [DataContract] + public partial class BucketsItems : IEquatable + { + /// + /// Policy values: `transient`, `temporary` or `persistent` + /// + /// Policy values: `transient`, `temporary` or `persistent` + [JsonConverter(typeof(StringEnumConverter))] + public enum PolicyKeyEnum + { + + /// + /// Enum Transient for "transient" + /// + [EnumMember(Value = "transient")] + Transient, + + /// + /// Enum Temporary for "temporary" + /// + [EnumMember(Value = "temporary")] + Temporary, + + /// + /// Enum Persistent for "persistent" + /// + [EnumMember(Value = "persistent")] + Persistent + } + + /// + /// Policy values: `transient`, `temporary` or `persistent` + /// + /// Policy values: `transient`, `temporary` or `persistent` + [DataMember(Name="policyKey", EmitDefaultValue=false)] + public PolicyKeyEnum? PolicyKey { get; set; } + + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BucketsItems() { } + + /// + /// Initializes a new instance of the class. + /// + /// Bucket key (required). + /// Timestamp in epoch time (required). + /// Policy values: `transient`, `temporary` or `persistent` (required). + public BucketsItems(string BucketKey = null, long? CreatedDate = null, PolicyKeyEnum? PolicyKey = null) + { + // to ensure "BucketKey" is required (not null) + if (BucketKey == null) + { + throw new InvalidDataException("BucketKey is a required property for BucketsItems and cannot be null"); + } + else + { + this.BucketKey = BucketKey; + } + // to ensure "CreatedDate" is required (not null) + if (CreatedDate == null) + { + throw new InvalidDataException("CreatedDate is a required property for BucketsItems and cannot be null"); + } + else + { + this.CreatedDate = CreatedDate; + } + // to ensure "PolicyKey" is required (not null) + if (PolicyKey == null) + { + throw new InvalidDataException("PolicyKey is a required property for BucketsItems and cannot be null"); + } + else + { + this.PolicyKey = PolicyKey; + } + } + + /// + /// Bucket key + /// + /// Bucket key + [DataMember(Name="bucketKey", EmitDefaultValue=false)] + public string BucketKey { get; set; } + /// + /// Timestamp in epoch time + /// + /// Timestamp in epoch time + [DataMember(Name="createdDate", EmitDefaultValue=false)] + public long? CreatedDate { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class BucketsItems {\n"); + sb.Append(" BucketKey: ").Append(BucketKey).Append("\n"); + sb.Append(" CreatedDate: ").Append(CreatedDate).Append("\n"); + sb.Append(" PolicyKey: ").Append(PolicyKey).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as BucketsItems); + } + + /// + /// Returns true if BucketsItems instances are equal + /// + /// Instance of BucketsItems to be compared + /// Boolean + public bool Equals(BucketsItems other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.BucketKey == other.BucketKey || + this.BucketKey != null && + this.BucketKey.Equals(other.BucketKey) + ) && + ( + this.CreatedDate == other.CreatedDate || + this.CreatedDate != null && + this.CreatedDate.Equals(other.CreatedDate) + ) && + ( + this.PolicyKey == other.PolicyKey || + this.PolicyKey != null && + this.PolicyKey.Equals(other.PolicyKey) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if (this.BucketKey != null) + hash = hash * 59 + this.BucketKey.GetHashCode(); + if (this.CreatedDate != null) + hash = hash * 59 + this.CreatedDate.GetHashCode(); + if (this.PolicyKey != null) + hash = hash * 59 + this.PolicyKey.GetHashCode(); + return hash; + } + } + } + +} + diff --git a/Autodesk.Forge/Model/Constants.cs b/Autodesk.Forge/Model/Constants.cs new file mode 100644 index 0000000..0a1000e --- /dev/null +++ b/Autodesk.Forge/Model/Constants.cs @@ -0,0 +1,43 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma warning disable 1591 +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using RestSharp; +using System.ComponentModel; +using System.Reflection; + +namespace Autodesk.Forge +{ + + public class oAuthConstants { + public const string CLIENT_CREDENTIALS ="client_credentials" ; + public const string CODE ="code" ; + public const string AUTHORIZATION_CODE ="authorization_code" ; + public const string REFRESH_TOKEN = "refresh_token" ; + } + +} +#pragma warning restore 1591 diff --git a/Autodesk.Forge/Model/DownloadItemDesc.cs b/Autodesk.Forge/Model/DownloadItemDesc.cs new file mode 100644 index 0000000..381b281 --- /dev/null +++ b/Autodesk.Forge/Model/DownloadItemDesc.cs @@ -0,0 +1,114 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.Threading.Tasks; + +namespace Autodesk.Forge.Model { + + public delegate Task RefreshTokenCallBack (); + public delegate void DownloadItemsCallBack (float progress, TimeSpan elapsed, List objects); + + /// + /// Post DownloadItemDesc Payload Body Structure + /// + public partial class DownloadItemDesc { + + public string objectKey { get; set; } + public string responseType { get; set; } + public Dictionary headers { get; set; } + + protected Stream dataStream = null; + protected byte [] dataBytes = null; + public dynamic data { + get { + if ( dataStream != null ) + return (dataStream); + else if ( responseType == "text" || responseType == "json" ) + return (System.Text.Encoding.UTF8.GetString (dataBytes)); + else + return (dataBytes); + } + set { + if ( value is Stream ) + dataStream = value; + else if ( value is string ) + dataBytes = Encoding.UTF8.GetBytes (value); + else + dataBytes = value; + } + } + public bool isStream { get { return (dataStream != null); } } + + public float Progress { get; set; } + public dynamic downloadParams { get; set; } + public string downloadUrl { get; set; } + public dynamic download { get; set; } + + public bool Error { get; set; } + + /// + /// Initializes a new instance of the class. + /// + protected DownloadItemDesc () { } + + public DownloadItemDesc ( + string objectKey, + string responseType, + Stream data = null, + Dictionary headers = null + ) { + if ( objectKey == null ) + throw new InvalidDataException ("objectKey is a required property for DownloadItemDesc and cannot be null"); + if ( responseType == null ) + throw new InvalidDataException ("responseType is a required property for DownloadItemDesc and cannot be null"); + //if ( responseType == "stream" && (data == null || data.CanWrite == false) ) + // throw new InvalidDataException ("data is a required property for DownloadItemDesc and cannot be null and should be writable when contentType == 'stream'"); + this.objectKey = objectKey; + this.responseType = responseType; + this.data = data; + this.headers = headers; + } + + public override string ToString () { + var sb = new StringBuilder (); + sb.Append ("DownloadItemDesc {"); + sb.Append (" objectKey: \"").Append (objectKey).Append ("\","); + sb.Append (" responseType: \"").Append (responseType).Append ("\","); + sb.Append (" Progress: ").Append (Progress).Append (","); + sb.Append ("}\n"); + return (sb.ToString ()); + } + + } + +} + diff --git a/Autodesk.Forge/Model/DynamicJsonResponse.cs b/Autodesk.Forge/Model/DynamicJsonResponse.cs new file mode 100644 index 0000000..2651227 --- /dev/null +++ b/Autodesk.Forge/Model/DynamicJsonResponse.cs @@ -0,0 +1,417 @@ +// (C) Copyright, Autodesk, Inc. +// +// Permission to use, copy, modify, and distribute this software in +// object code form for any purpose and without fee is hereby granted, +// provided that the above copyright notice appears in all copies and +// that both that copyright notice and the limited warranty and +// restricted rights notice below appear in all supporting +// documentation. +// +// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. +// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. +// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE +// UNINTERRUPTED OR ERROR FREE. + +// Written by Cyrille Fauvel, Autodesk Developer Network (ADN) +// http://www.autodesk.com/joinadn +// +#pragma warning disable 1591 +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml; +using System.Xml.Linq; +using System.Dynamic; +using System.Runtime.Serialization; + +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System.Collections; + +namespace Autodesk.Forge.Model { + + public class DynamicDictionary : DynamicObject {//, IEnumerable> { + public Dictionary Dictionary { get; internal set; } + + public DynamicDictionary () : base () { + Dictionary =new Dictionary () ; + } + + #region Get/Set + + public bool ContainsKey (string key) { + return (Dictionary.ContainsKey (key)) ; + } + + public override bool TryGetMember (GetMemberBinder binder, out object result) { + // Converting the property name to lowercase so that property names become case-insensitive. + string name =binder.Name/*.ToLower ()*/ ; + // If the property name is found in a dictionary, set the result parameter to the property value and return true. + // Otherwise, return false. + return (Dictionary.TryGetValue (name, out result)) ; + } + + // If you try to set a value of a property that is not defined in the class, this method is called. + public override bool TrySetMember (SetMemberBinder binder, object value) { + // Converting the property name to lowercase so that property names become case-insensitive. + Dictionary [binder.Name/*.ToLower ()*/] =value ; + // You can always add a value to a dictionary, so this method always returns true. + return (true) ; + } + + public override bool TryDeleteMember (DeleteMemberBinder binder) { + if ( Dictionary.ContainsKey (binder.Name/*.ToLower ()*/) ) + Dictionary.Remove (binder.Name/*.ToLower ()*/) ; + return (true) ; + } + + public override bool TryGetIndex (GetIndexBinder binder, object[] indexes, out object result) { + if ( IsInteger (indexes [0]) ) { + int index =(int)indexes [0] ; + // If the property name is found in a dictionary, set the result parameter to the property value and return true. + // Otherwise, return false. + return (Dictionary.TryGetValue (index.ToString (), out result)) ; + } //else + return (Dictionary.TryGetValue (indexes [0].ToString (), out result)) ; + } + + public override bool TrySetIndex (SetIndexBinder binder, object[] indexes, object value) { + if ( IsInteger (indexes [0]) ) { + int index =(int)indexes [0] ; + // If a corresponding property already exists, set the value. + if ( Dictionary.ContainsKey (index.ToString ()) ) + Dictionary [index.ToString ()] =value ; + else + // If a corresponding property does not exist, create it. + Dictionary.Add (index.ToString (), value) ; + } else { + if ( Dictionary.ContainsKey (indexes [0].ToString ()) ) + Dictionary [indexes [0].ToString ()] =value ; + else + // If a corresponding property does not exist, create it. + Dictionary.Add (indexes [0].ToString (), value) ; + } + return (true) ; + } + + public override bool TryDeleteIndex (DeleteIndexBinder binder, object[] indexes) { + if ( IsInteger (indexes [0]) ) { + int index =(int)indexes [0] ; + if ( Dictionary.ContainsKey (index.ToString ()) ) + Dictionary.Remove (index.ToString ()) ; + } else { + if ( Dictionary.ContainsKey (indexes [0].ToString ()) ) + Dictionary.Remove (indexes [0].ToString ()) ; + } + return (true) ; + } + + #endregion + + #region Enumerations + public int Count { + get { return (Dictionary.Count) ; } + } + + public override IEnumerable GetDynamicMemberNames () { + return (from p in Dictionary select p.Key) ; + } + + public virtual IEnumerable> Items () { + return (Dictionary) ; + } + + //IEnumerator> IEnumerable>.GetEnumerator () { + // return (Dictionary.GetEnumerator ()) ; + //} + + //IEnumerator IEnumerable.GetEnumerator () { + // return (Dictionary.GetEnumerator ()) ; + //} + + private static bool IsInteger (object value) { + return ( value is sbyte + || value is byte + || value is short + || value is ushort + || value is int + || value is uint + || value is long + || value is ulong + //|| value is float + //|| value is double + //|| value is decimal + ) ; + } + + #endregion + + #region ToString/ToJson + public override string ToString () { + return (ToString (Newtonsoft.Json.Formatting.None)) ; + } + + public string ToString (Newtonsoft.Json.Formatting formatting =Newtonsoft.Json.Formatting.Indented) { + JObject obj =ToJson () ; + return (obj.ToString (formatting)) ; + } + + internal void _ArrayDetection (ref JContainer obj) { + bool bArray =true ; + foreach ( JProperty prop in (obj as JObject).Properties () ) { + int val =0 ; + if ( Int32.TryParse (prop.Name, out val) != true ) { + bArray =false ; + break ; + } + } + if ( bArray == true ) { + JArray jarr =new JArray () ; + foreach ( JProperty item in obj ) + jarr.Add (item.Value) ; + obj =jarr ; + } + int nb =obj.Count ; + for ( int i =0 ; i < nb ; i++ ) { + JObject sub =null ; + JProperty prop =obj.ElementAtOrDefault (i) as JProperty ; + if ( prop != null ) { + if ( prop.Value.GetType () == typeof (JObject) ) + sub =prop.Value.ToObject () ; + } else { + sub =obj.ElementAtOrDefault (i) as JObject ; + } + if ( sub != null ) { + JContainer container =sub as JContainer ; + _ArrayDetection (ref container) ; + if ( prop != null ) + prop.Value.Replace (container) ; + else + sub.Replace (container) ; + } + } + } + + public JObject ToJson () { + //JArray obj =(JArray)JToken.FromObject (this) ; + //return (new JObject ()) ; + JObject obj =(JObject)JToken.FromObject (this) ; + JContainer container =obj as JContainer ; + _ArrayDetection (ref container) ; + return (obj) ; + } + + #endregion + } + + public class DynamicDictionaryItems : IEnumerable> { + private DynamicDictionary _dictionary ; + + private DynamicDictionaryItems () { + } + + public DynamicDictionaryItems (DynamicDictionary dict) { + _dictionary =dict ; + } + + public IEnumerator> GetEnumerator () { + return (_dictionary.Dictionary.GetEnumerator ()) ; + } + + IEnumerator IEnumerable.GetEnumerator () { + return (_dictionary.Dictionary.GetEnumerator ()) ; + } + + } + + public class DynamicJsonResponse : DynamicDictionary { + + #region Constructors + public DynamicJsonResponse () : base () { + } + + public DynamicJsonResponse (XDocument doc, string key ="Response") : base () { + ProcessElement (doc.Element (key), this) ; + } + + public DynamicJsonResponse (XElement elt) : base () { + ProcessElement (elt, this) ; + } + + public DynamicJsonResponse (JObject obj) : base () { + ProcessObject (obj, this) ; + } + + public DynamicJsonResponse (JArray obj) : base () { + ProcessArray (obj, this) ; + } + + #endregion + + public T ToObject(){ + return (T)this.ToJson().ToObject(typeof(T)); + } + + #region Reading object utilities + internal static void ProcessElement (XElement obj, DynamicDictionary dict) { + var elList =from el in obj.Elements () select el ; + foreach ( XElement elt in elList ) { + if ( elt.HasElements == false ) { + dict.Dictionary [elt.Name.LocalName] =(string)elt ; + } else { + // Careful, might be an array + bool isArray =(elt.Elements ().Count () != elt.Elements().Select (el => el.Name).Distinct ().Count ()) ; + DynamicDictionary subDict =new DynamicDictionary () ; + if ( isArray ) + ProcessElementArray (elt, subDict) ; + else + ProcessElement (elt, subDict) ; + dict.Dictionary [elt.Name.LocalName] =subDict ; + } + } + } + + internal static void ProcessElementArray (XElement obj, DynamicDictionary dict) { + var elList = from el in obj.Elements () select el ; + int i =0 ; + foreach ( XElement elt in elList ) { + if ( elt.HasElements == false ) { + dict.Dictionary [i.ToString ()] =(string)elt ; + } else { + // Careful, might be an array + bool isArray =(elt.Elements ().Count () != elt.Elements().Select (el => el.Name).Distinct ().Count ()) ; + DynamicDictionary subDict =new DynamicDictionary () ; + ProcessElement (elt, subDict) ; + if ( isArray ) + ProcessElementArray (elt, subDict) ; + else + ProcessElement (elt, subDict) ; + dict.Dictionary [i.ToString ()] = subDict ; + } + i++ ; + } + } + + internal static void ProcessObject (JObject obj, DynamicDictionary dict) { + foreach ( KeyValuePair pair in obj ) { + if ( pair.Value.GetType () == typeof (JValue) ) { + dict.Dictionary [pair.Key] =((JValue)pair.Value).Value ; + } else if ( pair.Value.GetType () == typeof (JObject) ) { + DynamicDictionary subDict =new DynamicDictionary () ; + ProcessObject ((JObject)(pair.Value), subDict) ; + dict.Dictionary [pair.Key] =subDict ; + } else if ( pair.Value.GetType () == typeof (JArray) ) { + DynamicDictionary subDict =new DynamicDictionary () ; + ProcessArray ((JArray)(pair.Value), subDict) ; + dict.Dictionary [pair.Key] =subDict ; + } + } + } + + internal static void ProcessArray (JArray obj, DynamicDictionary dict) { + int i =0 ; + foreach ( JToken item in obj ) { + if ( item.GetType () == typeof (JValue) ) { + dict.Dictionary [i.ToString ()] =((JValue)item).Value ; + } else if ( item.GetType () == typeof (JObject) ) { + DynamicDictionary subDict =new DynamicDictionary (); + ProcessObject ((JObject)(item), subDict) ; + dict.Dictionary [i.ToString ()] =subDict ; + } else if ( item.GetType () == typeof (JArray) ) { + DynamicDictionary subDict =new DynamicDictionary (); + ProcessArray ((JArray)item, subDict) ; + dict.Dictionary [i.ToString ()] =subDict ; + } + i++ ; + } + } + + #endregion + + //#region ToString/ToJson + //public override string ToString () { + // return (ToString (Newtonsoft.Json.Formatting.None)) ; + //} + + //public string ToString (Newtonsoft.Json.Formatting formatting =Newtonsoft.Json.Formatting.Indented) { + // JObject obj =ToJson () ; + // return (obj.ToString (formatting)) ; + //} + + //internal void _ArrayDetection (ref JContainer obj) { + // bool bArray =true ; + // foreach ( JProperty prop in (obj as JObject).Properties () ) { + // int val =0 ; + // if ( Int32.TryParse (prop.Name, out val) != true ) { + // bArray =false ; + // break ; + // } + // } + // if ( bArray == true ) { + // JArray jarr =new JArray () ; + // foreach ( JProperty item in obj ) + // jarr.Add (item.Value) ; + // obj =jarr ; + // } + // int nb =obj.Count ; + // for ( int i =0 ; i < nb ; i++ ) { + // JObject sub =null ; + // JProperty prop =obj.ElementAtOrDefault (i) as JProperty ; + // if ( prop != null ) { + // if ( prop.Value.GetType () == typeof (JObject) ) + // sub =prop.Value.ToObject () ; + // } else { + // sub =obj.ElementAtOrDefault (i) as JObject ; + // } + // if ( sub != null ) { + // JContainer container =sub as JContainer ; + // _ArrayDetection (ref container) ; + // if ( prop != null ) + // prop.Value.Replace (container) ; + // else + // sub.Replace (container) ; + // } + // } + //} + + //public JObject ToJson () { + // //JArray obj =(JArray)JToken.FromObject (this) ; + // //return (new JObject ()) ; + // JObject obj = (JObject)JToken.FromObject (this); + // JContainer container = obj as JContainer; + // _ArrayDetection (ref container); + // return (obj); + //} + + //#endregion + + } + + partial class StringEnum { + + public static string ToEnumString (T type) { + var enumType =typeof (T) ; + var name =Enum.GetName (enumType, type) ; + var enumMemberAttribute =((EnumMemberAttribute [])enumType.GetField (name).GetCustomAttributes (typeof (EnumMemberAttribute), true)).Single () ; + return (enumMemberAttribute.Value) ; + } + + public static T ToEnum (string str) { + var enumType =typeof (T) ; + foreach ( var name in Enum.GetNames (enumType) ) { + var enumMemberAttribute =((EnumMemberAttribute [])enumType.GetField (name).GetCustomAttributes (typeof (EnumMemberAttribute), true)).Single () ; + if ( enumMemberAttribute.Value == str ) + return ((T)Enum.Parse (enumType, name)) ; + } + //throw exception or whatever handling you want or + return (default (T)) ; + } + + } + +} +#pragma warning restore 1591 diff --git a/Autodesk.Forge/Model/ObjectDetails.cs b/Autodesk.Forge/Model/ObjectDetails.cs new file mode 100644 index 0000000..15e5984 --- /dev/null +++ b/Autodesk.Forge/Model/ObjectDetails.cs @@ -0,0 +1,224 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Autodesk.Forge.Model +{ + /// + /// Object json response + /// + [DataContract] + public partial class ObjectDetails : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// Bucket key. + /// Object URN. + /// Object name. + /// Object SHA1. + /// Object size. + /// Object content-type. + /// URL to download the object. + public ObjectDetails(string BucketKey = null, string ObjectId = null, string ObjectKey = null, byte[] Sha1 = null, int? Size = null, string ContentType = null, string Location = null) + { + this.BucketKey = BucketKey; + this.ObjectId = ObjectId; + this.ObjectKey = ObjectKey; + this.Sha1 = Sha1; + this.Size = Size; + this.ContentType = ContentType; + this.Location = Location; + } + + /// + /// Bucket key + /// + /// Bucket key + [DataMember(Name="bucketKey", EmitDefaultValue=false)] + public string BucketKey { get; set; } + /// + /// Object URN + /// + /// Object URN + [DataMember(Name="objectId", EmitDefaultValue=false)] + public string ObjectId { get; set; } + /// + /// Object name + /// + /// Object name + [DataMember(Name="objectKey", EmitDefaultValue=false)] + public string ObjectKey { get; set; } + /// + /// Object SHA1 + /// + /// Object SHA1 + [DataMember(Name="sha1", EmitDefaultValue=false)] + public byte[] Sha1 { get; set; } + /// + /// Object size + /// + /// Object size + [DataMember(Name="size", EmitDefaultValue=false)] + public int? Size { get; set; } + /// + /// Object content-type + /// + /// Object content-type + [DataMember(Name="contentType", EmitDefaultValue=false)] + public string ContentType { get; set; } + /// + /// URL to download the object + /// + /// URL to download the object + [DataMember(Name="location", EmitDefaultValue=false)] + public string Location { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class ObjectDetails {\n"); + sb.Append(" BucketKey: ").Append(BucketKey).Append("\n"); + sb.Append(" ObjectId: ").Append(ObjectId).Append("\n"); + sb.Append(" ObjectKey: ").Append(ObjectKey).Append("\n"); + sb.Append(" Sha1: ").Append(Sha1).Append("\n"); + sb.Append(" Size: ").Append(Size).Append("\n"); + sb.Append(" ContentType: ").Append(ContentType).Append("\n"); + sb.Append(" Location: ").Append(Location).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as ObjectDetails); + } + + /// + /// Returns true if ObjectDetails instances are equal + /// + /// Instance of ObjectDetails to be compared + /// Boolean + public bool Equals(ObjectDetails other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.BucketKey == other.BucketKey || + this.BucketKey != null && + this.BucketKey.Equals(other.BucketKey) + ) && + ( + this.ObjectId == other.ObjectId || + this.ObjectId != null && + this.ObjectId.Equals(other.ObjectId) + ) && + ( + this.ObjectKey == other.ObjectKey || + this.ObjectKey != null && + this.ObjectKey.Equals(other.ObjectKey) + ) && + ( + this.Sha1 == other.Sha1 || + this.Sha1 != null && + this.Sha1.Equals(other.Sha1) + ) && + ( + this.Size == other.Size || + this.Size != null && + this.Size.Equals(other.Size) + ) && + ( + this.ContentType == other.ContentType || + this.ContentType != null && + this.ContentType.Equals(other.ContentType) + ) && + ( + this.Location == other.Location || + this.Location != null && + this.Location.Equals(other.Location) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if (this.BucketKey != null) + hash = hash * 59 + this.BucketKey.GetHashCode(); + if (this.ObjectId != null) + hash = hash * 59 + this.ObjectId.GetHashCode(); + if (this.ObjectKey != null) + hash = hash * 59 + this.ObjectKey.GetHashCode(); + if (this.Sha1 != null) + hash = hash * 59 + this.Sha1.GetHashCode(); + if (this.Size != null) + hash = hash * 59 + this.Size.GetHashCode(); + if (this.ContentType != null) + hash = hash * 59 + this.ContentType.GetHashCode(); + if (this.Location != null) + hash = hash * 59 + this.Location.GetHashCode(); + return hash; + } + } + } + +} + diff --git a/Autodesk.Forge/Model/ObjectFullDetails.cs b/Autodesk.Forge/Model/ObjectFullDetails.cs new file mode 100644 index 0000000..cd15cd8 --- /dev/null +++ b/Autodesk.Forge/Model/ObjectFullDetails.cs @@ -0,0 +1,256 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Autodesk.Forge.Model +{ + /// + /// Object Details json response + /// + [DataContract] + public partial class ObjectFullDetails : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// Bucket key. + /// Object URN. + /// Object name. + /// Object SHA1. + /// Object size. + /// Object content-type. + /// URL to download the object. + /// For delta-encoding. Represents whether a signature exists at a specific block size. + /// Patch files available for download related to this object. + public ObjectFullDetails(string BucketKey = null, string ObjectId = null, string ObjectKey = null, byte[] Sha1 = null, int? Size = null, string ContentType = null, string Location = null, List BlockSizes = null, List Deltas = null) + { + this.BucketKey = BucketKey; + this.ObjectId = ObjectId; + this.ObjectKey = ObjectKey; + this.Sha1 = Sha1; + this.Size = Size; + this.ContentType = ContentType; + this.Location = Location; + this.BlockSizes = BlockSizes; + this.Deltas = Deltas; + } + + /// + /// Bucket key + /// + /// Bucket key + [DataMember(Name="bucketKey", EmitDefaultValue=false)] + public string BucketKey { get; set; } + /// + /// Object URN + /// + /// Object URN + [DataMember(Name="objectId", EmitDefaultValue=false)] + public string ObjectId { get; set; } + /// + /// Object name + /// + /// Object name + [DataMember(Name="objectKey", EmitDefaultValue=false)] + public string ObjectKey { get; set; } + /// + /// Object SHA1 + /// + /// Object SHA1 + [DataMember(Name="sha1", EmitDefaultValue=false)] + public byte[] Sha1 { get; set; } + /// + /// Object size + /// + /// Object size + [DataMember(Name="size", EmitDefaultValue=false)] + public int? Size { get; set; } + /// + /// Object content-type + /// + /// Object content-type + [DataMember(Name="contentType", EmitDefaultValue=false)] + public string ContentType { get; set; } + /// + /// URL to download the object + /// + /// URL to download the object + [DataMember(Name="location", EmitDefaultValue=false)] + public string Location { get; set; } + /// + /// For delta-encoding. Represents whether a signature exists at a specific block size + /// + /// For delta-encoding. Represents whether a signature exists at a specific block size + [DataMember(Name="blockSizes", EmitDefaultValue=false)] + public List BlockSizes { get; set; } + /// + /// Patch files available for download related to this object + /// + /// Patch files available for download related to this object + [DataMember(Name="deltas", EmitDefaultValue=false)] + public List Deltas { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class ObjectFullDetails {\n"); + sb.Append(" BucketKey: ").Append(BucketKey).Append("\n"); + sb.Append(" ObjectId: ").Append(ObjectId).Append("\n"); + sb.Append(" ObjectKey: ").Append(ObjectKey).Append("\n"); + sb.Append(" Sha1: ").Append(Sha1).Append("\n"); + sb.Append(" Size: ").Append(Size).Append("\n"); + sb.Append(" ContentType: ").Append(ContentType).Append("\n"); + sb.Append(" Location: ").Append(Location).Append("\n"); + sb.Append(" BlockSizes: ").Append(BlockSizes).Append("\n"); + sb.Append(" Deltas: ").Append(Deltas).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as ObjectFullDetails); + } + + /// + /// Returns true if ObjectFullDetails instances are equal + /// + /// Instance of ObjectFullDetails to be compared + /// Boolean + public bool Equals(ObjectFullDetails other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.BucketKey == other.BucketKey || + this.BucketKey != null && + this.BucketKey.Equals(other.BucketKey) + ) && + ( + this.ObjectId == other.ObjectId || + this.ObjectId != null && + this.ObjectId.Equals(other.ObjectId) + ) && + ( + this.ObjectKey == other.ObjectKey || + this.ObjectKey != null && + this.ObjectKey.Equals(other.ObjectKey) + ) && + ( + this.Sha1 == other.Sha1 || + this.Sha1 != null && + this.Sha1.Equals(other.Sha1) + ) && + ( + this.Size == other.Size || + this.Size != null && + this.Size.Equals(other.Size) + ) && + ( + this.ContentType == other.ContentType || + this.ContentType != null && + this.ContentType.Equals(other.ContentType) + ) && + ( + this.Location == other.Location || + this.Location != null && + this.Location.Equals(other.Location) + ) && + ( + this.BlockSizes == other.BlockSizes || + this.BlockSizes != null && + this.BlockSizes.SequenceEqual(other.BlockSizes) + ) && + ( + this.Deltas == other.Deltas || + this.Deltas != null && + this.Deltas.SequenceEqual(other.Deltas) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if (this.BucketKey != null) + hash = hash * 59 + this.BucketKey.GetHashCode(); + if (this.ObjectId != null) + hash = hash * 59 + this.ObjectId.GetHashCode(); + if (this.ObjectKey != null) + hash = hash * 59 + this.ObjectKey.GetHashCode(); + if (this.Sha1 != null) + hash = hash * 59 + this.Sha1.GetHashCode(); + if (this.Size != null) + hash = hash * 59 + this.Size.GetHashCode(); + if (this.ContentType != null) + hash = hash * 59 + this.ContentType.GetHashCode(); + if (this.Location != null) + hash = hash * 59 + this.Location.GetHashCode(); + if (this.BlockSizes != null) + hash = hash * 59 + this.BlockSizes.GetHashCode(); + if (this.Deltas != null) + hash = hash * 59 + this.Deltas.GetHashCode(); + return hash; + } + } + } + +} + diff --git a/Autodesk.Forge/Model/ObjectFullDetailsDeltas.cs b/Autodesk.Forge/Model/ObjectFullDetailsDeltas.cs new file mode 100644 index 0000000..3a8ffcb --- /dev/null +++ b/Autodesk.Forge/Model/ObjectFullDetailsDeltas.cs @@ -0,0 +1,142 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Autodesk.Forge.Model +{ + /// + /// ObjectFullDetailsDeltas + /// + [DataContract] + public partial class ObjectFullDetailsDeltas : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// Position. + /// Sha1. + public ObjectFullDetailsDeltas(int? Position = null, string Sha1 = null) + { + this.Position = Position; + this.Sha1 = Sha1; + } + + /// + /// Gets or Sets Position + /// + [DataMember(Name="position", EmitDefaultValue=false)] + public int? Position { get; set; } + /// + /// Gets or Sets Sha1 + /// + [DataMember(Name="sha1", EmitDefaultValue=false)] + public string Sha1 { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class ObjectFullDetailsDeltas {\n"); + sb.Append(" Position: ").Append(Position).Append("\n"); + sb.Append(" Sha1: ").Append(Sha1).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as ObjectFullDetailsDeltas); + } + + /// + /// Returns true if ObjectFullDetailsDeltas instances are equal + /// + /// Instance of ObjectFullDetailsDeltas to be compared + /// Boolean + public bool Equals(ObjectFullDetailsDeltas other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.Position == other.Position || + this.Position != null && + this.Position.Equals(other.Position) + ) && + ( + this.Sha1 == other.Sha1 || + this.Sha1 != null && + this.Sha1.Equals(other.Sha1) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if (this.Position != null) + hash = hash * 59 + this.Position.GetHashCode(); + if (this.Sha1 != null) + hash = hash * 59 + this.Sha1.GetHashCode(); + return hash; + } + } + } + +} + diff --git a/Autodesk.Forge/Model/Permission.cs b/Autodesk.Forge/Model/Permission.cs new file mode 100644 index 0000000..274d11c --- /dev/null +++ b/Autodesk.Forge/Model/Permission.cs @@ -0,0 +1,144 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Autodesk.Forge.Model +{ + /// + /// Permission + /// + [DataContract] + public partial class Permission : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// The authentication ID. + /// The authentication access type. + public Permission(string AuthId = null, string Access = null) + { + this.AuthId = AuthId; + this.Access = Access; + } + + /// + /// The authentication ID + /// + /// The authentication ID + [DataMember(Name="authId", EmitDefaultValue=false)] + public string AuthId { get; set; } + /// + /// The authentication access type + /// + /// The authentication access type + [DataMember(Name="access", EmitDefaultValue=false)] + public string Access { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Permission {\n"); + sb.Append(" AuthId: ").Append(AuthId).Append("\n"); + sb.Append(" Access: ").Append(Access).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as Permission); + } + + /// + /// Returns true if Permission instances are equal + /// + /// Instance of Permission to be compared + /// Boolean + public bool Equals(Permission other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.AuthId == other.AuthId || + this.AuthId != null && + this.AuthId.Equals(other.AuthId) + ) && + ( + this.Access == other.Access || + this.Access != null && + this.Access.Equals(other.Access) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if (this.AuthId != null) + hash = hash * 59 + this.AuthId.GetHashCode(); + if (this.Access != null) + hash = hash * 59 + this.Access.GetHashCode(); + return hash; + } + } + } + +} + diff --git a/Autodesk.Forge/Model/PostBatchCompleteS3UploadPayload.cs b/Autodesk.Forge/Model/PostBatchCompleteS3UploadPayload.cs new file mode 100644 index 0000000..3c1674d --- /dev/null +++ b/Autodesk.Forge/Model/PostBatchCompleteS3UploadPayload.cs @@ -0,0 +1,283 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Autodesk.Forge.Model { + + /// + /// Post PostBatchCompleteS3UploadPayloadItem Payload Body Structure + /// + [DataContract] + public partial class PostBatchCompleteS3UploadPayloadItem : IEquatable { + + [DataMember (Name = "objectKey", EmitDefaultValue = false)] + public string objectKey { get; set; } + + [DataMember (Name = "uploadKey", EmitDefaultValue = false)] + public string uploadKey { get; set; } + + [DataMember (Name = "size", EmitDefaultValue = false)] + public long? size { get; set; } + + [DataMember (Name = "eTags", EmitDefaultValue = false)] + public List eTags { get; set; } + + [DataMember (Name = "x-ads-meta-Content-Type", EmitDefaultValue = false)] + public string xAdsMetaContentType { get; set; } + + [DataMember (Name = "x-ads-meta-Content-Disposition", EmitDefaultValue = false)] + public string xAdsMetaContentDisposition { get; set; } + + [DataMember (Name = "x-ads-meta-Content-Encoding", EmitDefaultValue = false)] + public string xAdsMetaContentEncoding { get; set; } + + [DataMember (Name = "x-ads-meta-Cache-Control", EmitDefaultValue = false)] + public string xAdsMetaCacheControl { get; set; } + + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PostBatchCompleteS3UploadPayloadItem () { } + + public PostBatchCompleteS3UploadPayloadItem ( + string objectKey, string uploadKey, long? size, List eTags = null, + string xAdsMetaContentType = null, + string xAdsMetaContentDisposition = null, + string xAdsMetaContentEncoding = null, + string xAdsMetaCacheControl = null + ) { + if ( String.IsNullOrEmpty (objectKey) ) + throw new InvalidDataException ("objectKey is a required property for PostBatchCompleteS3UploadPayloadItem and cannot be null or empty"); + if ( String.IsNullOrEmpty (uploadKey) ) + throw new InvalidDataException ("uploadKey is a required property for PostBatchCompleteS3UploadPayloadItem and cannot be null or empty"); + this.objectKey = objectKey; + this.uploadKey = uploadKey; + this.size = size; + this.eTags = eTags; + this.xAdsMetaContentType = xAdsMetaContentType; + this.xAdsMetaContentDisposition = xAdsMetaContentDisposition; + this.xAdsMetaContentEncoding = xAdsMetaContentEncoding; + this.xAdsMetaCacheControl = xAdsMetaCacheControl; + } + + public override string ToString () { + var sb = new StringBuilder (); + sb.Append ("class PostBatchCompleteS3UploadPayloadItem {\n"); + sb.Append (" objectKey: ").Append (objectKey).Append ("\n"); + sb.Append (" uploadKey: ").Append (uploadKey).Append ("\n"); + sb.Append (" size: ").Append (size).Append ("\n"); + sb.Append (" eTags: ").Append (eTags).Append ("\n"); + sb.Append (" xAdsMetaContentType: ").Append (xAdsMetaContentType).Append ("\n"); + sb.Append (" xAdsMetaContentDisposition: ").Append (xAdsMetaContentDisposition).Append ("\n"); + sb.Append (" xAdsMetaContentEncoding: ").Append (xAdsMetaContentEncoding).Append ("\n"); + sb.Append (" xAdsMetaCacheControl: ").Append (xAdsMetaCacheControl).Append ("\n"); + sb.Append ("}\n"); + return (sb.ToString ()); + } + + public string ToJson () { + return (JsonConvert.SerializeObject (this, Formatting.Indented)); + } + + public override bool Equals (object obj) { + // credit: http://stackoverflow.com/a/10454552/677735 + return (this.Equals (obj as PostBatchCompleteS3UploadPayloadItem)); + } + + /// + /// Returns true if PostBatchCompleteS3UploadPayloadItem instances are equal + /// + /// Instance of PostBatchCompleteS3UploadPayloadItem to be compared + /// Boolean + public bool Equals (PostBatchCompleteS3UploadPayloadItem other) { + // credit: http://stackoverflow.com/a/10454552/677735 + if ( other == null ) + return (false); + + return ( + ( + this.objectKey == other.objectKey || + this.objectKey != null && + this.objectKey.Equals (other.objectKey) + ) + && + ( + this.uploadKey == other.uploadKey || + this.uploadKey != null && + this.uploadKey.Equals (other.uploadKey) + ) + && + ( + this.size == other.size || + this.size != null && + this.size.Equals (other.size) + ) + && + ( + this.eTags == other.eTags || + this.eTags != null && + this.eTags.SequenceEqual (other.eTags) + ) + && + ( + this.xAdsMetaContentType == other.xAdsMetaContentType || + this.xAdsMetaContentType != null && + this.xAdsMetaContentType.Equals (other.xAdsMetaContentType) + ) + && + ( + this.xAdsMetaContentDisposition == other.xAdsMetaContentDisposition || + this.xAdsMetaContentDisposition != null && + this.xAdsMetaContentDisposition.Equals (other.xAdsMetaContentDisposition) + ) + && + ( + this.xAdsMetaContentEncoding == other.xAdsMetaContentEncoding || + this.xAdsMetaContentEncoding != null && + this.xAdsMetaContentEncoding.Equals (other.xAdsMetaContentEncoding) + ) + && + ( + this.xAdsMetaCacheControl == other.xAdsMetaCacheControl || + this.xAdsMetaCacheControl != null && + this.xAdsMetaCacheControl.Equals (other.xAdsMetaCacheControl) + ) + ); + } + + public override int GetHashCode () { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if ( this.objectKey != null ) + hash = hash * 59 + this.objectKey.GetHashCode (); + if ( this.uploadKey != null ) + hash = hash * 59 + this.uploadKey.GetHashCode (); + if ( this.size != null ) + hash = hash * 59 + this.size.GetHashCode (); + if ( this.eTags != null ) + hash = hash * 59 + this.eTags.GetHashCode (); + if ( this.xAdsMetaContentType != null ) + hash = hash * 59 + this.xAdsMetaContentType.GetHashCode (); + if ( this.xAdsMetaContentDisposition != null ) + hash = hash * 59 + this.xAdsMetaContentDisposition.GetHashCode (); + if ( this.xAdsMetaContentEncoding != null ) + hash = hash * 59 + this.xAdsMetaContentEncoding.GetHashCode (); + if ( this.xAdsMetaCacheControl != null ) + hash = hash * 59 + this.xAdsMetaCacheControl.GetHashCode (); + return (hash); + } + } + + } + + /// + /// Post PostCompleteS3UploadsPayload Payload Body Structure + /// + [DataContract] + public partial class PostBatchCompleteS3UploadPayload : IEquatable { + + [DataMember (Name = "requests", EmitDefaultValue = false)] + public List requests { get; set; } + + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PostBatchCompleteS3UploadPayload () { } + + public PostBatchCompleteS3UploadPayload (PostBatchCompleteS3UploadPayloadItem item) { + this.requests = new List () { item }; + } + + public PostBatchCompleteS3UploadPayload (List items) { + if ( items == null ) + //throw new InvalidDataException ("requests is a required property for PostCompleteS3UploadsPayload and cannot be null or empty"); + items = new List (); + this.requests = items; + } + + public override string ToString () { + var sb = new StringBuilder (); + sb.Append ("class PostCompleteS3UploadsPayload {\n"); + sb.Append (" uploadKey: ").Append (requests).Append ("\n"); + sb.Append ("}\n"); + return (sb.ToString ()); + } + + public string ToJson () { + return (JsonConvert.SerializeObject (this, Formatting.Indented)); + } + + public override bool Equals (object obj) { + // credit: http://stackoverflow.com/a/10454552/677735 + return (this.Equals (obj as PostBatchCompleteS3UploadPayload)); + } + + /// + /// Returns true if PostCompleteS3UploadsPayload instances are equal + /// + /// Instance of PostCompleteS3UploadsPayload to be compared + /// Boolean + public bool Equals (PostBatchCompleteS3UploadPayload other) { + // credit: http://stackoverflow.com/a/10454552/677735 + if ( other == null ) + return (false); + + return ( + ( + this.requests == other.requests || + this.requests != null && + this.requests.SequenceEqual (other.requests) + ) + ); + } + + public override int GetHashCode () { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if ( this.requests != null ) + hash = hash * 59 + this.requests.GetHashCode (); + return (hash); + } + } + + } + +} + diff --git a/Autodesk.Forge/Model/PostBatchSignedS3DownloadPayload.cs b/Autodesk.Forge/Model/PostBatchSignedS3DownloadPayload.cs new file mode 100644 index 0000000..57d6ad4 --- /dev/null +++ b/Autodesk.Forge/Model/PostBatchSignedS3DownloadPayload.cs @@ -0,0 +1,258 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Autodesk.Forge.Model { + + /// + /// Post PostBatchSignedS3DownloadPayloadItem Payload Body Structure + /// + [DataContract] + public partial class PostBatchSignedS3DownloadPayloadItem : IEquatable { + + [DataMember (Name = "objectKey", EmitDefaultValue = false)] + public string objectKey { get; set; } + + [DataMember (Name = "response-content-type", EmitDefaultValue = false)] + public string responseContentType { get; set; } + + [DataMember (Name = "response-content-disposition", EmitDefaultValue = false)] + public string responseContentDisposition { get; set; } + + [DataMember (Name = "response-cache-control", EmitDefaultValue = false)] + public string responseCacheControl { get; set; } + + [DataMember (Name = "If-None-Match", EmitDefaultValue = false)] + public string IfNoneMatch { get; set; } + + [DataMember (Name = "If-Modified-Since", EmitDefaultValue = false)] + public string IfModifiedSince { get; set; } + + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PostBatchSignedS3DownloadPayloadItem () { } + + public PostBatchSignedS3DownloadPayloadItem ( + string objectKey, + string responseContentType = null, + string responseContentDisposition = null, + string responseCacheControl = null, + string IfNoneMatch = null, + string IfModifiedSince = null + ) { + if ( objectKey == null ) + throw new InvalidDataException ("objectKey is a required property for PostBatchSignedS3DownloadPayloadItem and cannot be null"); + this.objectKey = objectKey; + this.responseContentType = responseContentType; + this.responseContentDisposition = responseContentDisposition; + this.responseCacheControl = responseCacheControl; + this.IfNoneMatch = IfNoneMatch; + this.IfModifiedSince = IfModifiedSince; + } + + public override string ToString () { + var sb = new StringBuilder (); + sb.Append ("class PostBatchSignedS3DownloadPayloadItem {\n"); + sb.Append (" objectKey: ").Append (objectKey).Append ("\n"); + sb.Append (" response-content-type: ").Append (responseContentType).Append ("\n"); + sb.Append (" response-content-disposition: ").Append (responseContentDisposition).Append ("\n"); + sb.Append (" response-cache-control: ").Append (responseCacheControl).Append ("\n"); + sb.Append (" If-None-Match: ").Append (IfNoneMatch).Append ("\n"); + sb.Append (" If-Modified-Since: ").Append (IfModifiedSince).Append ("\n"); + sb.Append ("}\n"); + return (sb.ToString ()); + } + + public string ToJson () { + return (JsonConvert.SerializeObject (this, Formatting.Indented)); + } + + public override bool Equals (object obj) { + // credit: http://stackoverflow.com/a/10454552/677735 + return (this.Equals (obj as PostBatchSignedS3DownloadPayloadItem)); + } + + /// + /// Returns true if PostBatchSignedS3DownloadPayload instances are equal + /// + /// Instance of PostBatchSignedS3DownloadPayload to be compared + /// Boolean + public bool Equals (PostBatchSignedS3DownloadPayloadItem other) { + // credit: http://stackoverflow.com/a/10454552/677735 + if ( other == null ) + return (false); + + return ( + ( + this.objectKey == other.objectKey || + this.objectKey != null && + this.objectKey.Equals (other.objectKey) + ) + && + ( + this.responseContentType == other.objectKey || + this.responseContentType != null && + this.responseContentType.Equals (other.responseContentType) + ) + && + ( + this.responseContentDisposition == other.responseContentDisposition || + this.responseContentDisposition != null && + this.responseContentDisposition.Equals (other.responseContentDisposition) + ) + && + ( + this.responseCacheControl == other.responseCacheControl || + this.responseCacheControl != null && + this.responseCacheControl.Equals (other.responseCacheControl) + ) + && + ( + this.IfNoneMatch == other.IfNoneMatch || + this.IfNoneMatch != null && + this.IfNoneMatch.Equals (other.IfNoneMatch) + ) + && + ( + this.IfModifiedSince == other.IfModifiedSince || + this.IfModifiedSince != null && + this.IfModifiedSince.Equals (other.IfNoneMatch) + ) + ); + } + + public override int GetHashCode () { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if ( this.objectKey != null ) + hash = hash * 59 + this.objectKey.GetHashCode (); + if ( this.responseContentType != null ) + hash = hash * 59 + this.responseContentType.GetHashCode (); + if ( this.responseContentDisposition != null ) + hash = hash * 59 + this.responseContentDisposition.GetHashCode (); + if ( this.responseCacheControl != null ) + hash = hash * 59 + this.responseCacheControl.GetHashCode (); + if ( this.IfNoneMatch != null ) + hash = hash * 59 + this.IfNoneMatch.GetHashCode (); + if ( this.IfModifiedSince != null ) + hash = hash * 59 + this.IfModifiedSince.GetHashCode (); + return (hash); + } + } + + } + + /// + /// Post PostBatchSignedS3DownloadPayload Payload Body Structure + /// + [DataContract] + public partial class PostBatchSignedS3DownloadPayload : IEquatable { + + [DataMember(Name="requests", EmitDefaultValue=false)] + public List requests { get; set; } + + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + public PostBatchSignedS3DownloadPayload() { + this.requests = new List (); + } + + public PostBatchSignedS3DownloadPayload(PostBatchSignedS3DownloadPayloadItem item = null) { + this.requests = new List () { item }; + } + + public PostBatchSignedS3DownloadPayload (List items = null) { + if ( items == null ) + //throw new InvalidDataException("items is a required property for PostBatchSignedS3DownloadPayload and cannot be null"); + items = new List (); + this.requests = items; + } + + public override string ToString() { + var sb = new StringBuilder(); + sb.Append("class PostBatchSignedS3DownloadPayload {\n"); + sb.Append(" requests: ").Append(requests).Append("\n"); + sb.Append("}\n"); + return (sb.ToString()); + } + + public string ToJson() { + return (JsonConvert.SerializeObject(this, Formatting.Indented)); + } + + public override bool Equals(object obj) { + // credit: http://stackoverflow.com/a/10454552/677735 + return (this.Equals(obj as PostBatchSignedS3DownloadPayload)); + } + + /// + /// Returns true if PostBatchSignedS3DownloadPayload instances are equal + /// + /// Instance of PostBatchSignedS3DownloadPayload to be compared + /// Boolean + public bool Equals(PostBatchSignedS3DownloadPayload other) { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return (false); + + return ( + ( + this.requests == other.requests || + this.requests != null && + this.requests.SequenceEqual(other.requests) + ) + ); + } + + public override int GetHashCode() { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if (this.requests != null) + hash = hash * 59 + this.requests.GetHashCode(); + return (hash); + } + } + + } + +} + diff --git a/Autodesk.Forge/Model/PostBatchSignedS3UploadPayload.cs b/Autodesk.Forge/Model/PostBatchSignedS3UploadPayload.cs new file mode 100644 index 0000000..f2b7fb4 --- /dev/null +++ b/Autodesk.Forge/Model/PostBatchSignedS3UploadPayload.cs @@ -0,0 +1,228 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Autodesk.Forge.Model { + + /// + /// Post PostBatchSignedS3UploadPayloadItem Payload Body Structure + /// + [DataContract] + public partial class PostBatchSignedS3UploadPayloadItem : IEquatable { + + [DataMember (Name = "objectKey", EmitDefaultValue = false)] + public string objectKey { get; set; } + + [DataMember (Name = "firstPart", EmitDefaultValue = false)] + public int? firstPart { get; set; } + + [DataMember (Name = "parts", EmitDefaultValue = false)] + public int? parts { get; set; } + + [DataMember (Name = "uploadKey", EmitDefaultValue = false)] + public string uploadKey { get; set; } + + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PostBatchSignedS3UploadPayloadItem () { } + + public PostBatchSignedS3UploadPayloadItem ( + string objectKey, + int? firstPart, + int? parts, + string uploadKey = null + ) { + if ( objectKey == null ) + throw new InvalidDataException ("objectKey is a required property for PostBatchSignedS3UploadPayloadItem and cannot be null"); + this.objectKey = objectKey; + this.firstPart = firstPart; + this.parts = parts; + this.uploadKey = uploadKey; + } + + public override string ToString () { + var sb = new StringBuilder (); + sb.Append ("class PostBatchSignedS3UploadPayloadItem {\n"); + sb.Append (" objectKey: ").Append (objectKey).Append ("\n"); + sb.Append (" firstPart: ").Append (firstPart).Append ("\n"); + sb.Append (" parts: ").Append (parts).Append ("\n"); + sb.Append (" uploadKey: ").Append (uploadKey).Append ("\n"); + sb.Append ("}\n"); + return (sb.ToString ()); + } + + public string ToJson () { + return (JsonConvert.SerializeObject (this, Formatting.Indented)); + } + + public override bool Equals (object obj) { + // credit: http://stackoverflow.com/a/10454552/677735 + return (this.Equals (obj as PostBatchSignedS3UploadPayloadItem)); + } + + /// + /// Returns true if PostBatchSignedS3UploadPayload instances are equal + /// + /// Instance of PostBatchSignedS3UploadPayload to be compared + /// Boolean + public bool Equals (PostBatchSignedS3UploadPayloadItem other) { + // credit: http://stackoverflow.com/a/10454552/677735 + if ( other == null ) + return (false); + + return ( + ( + this.objectKey == other.objectKey || + this.objectKey != null && + this.objectKey.Equals (other.objectKey) + ) + && + ( + this.firstPart == other.firstPart || + this.firstPart != null && + this.firstPart.Equals (other.firstPart) + ) + && + ( + this.parts == other.parts || + this.parts != null && + this.parts.Equals (other.parts) + ) + && + ( + this.uploadKey == other.uploadKey || + this.uploadKey != null && + this.uploadKey.Equals (other.uploadKey) + ) + ); + } + + public override int GetHashCode () { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if ( this.objectKey != null ) + hash = hash * 59 + this.objectKey.GetHashCode (); + if ( this.firstPart != null ) + hash = hash * 59 + this.firstPart.GetHashCode (); + if ( this.parts != null ) + hash = hash * 59 + this.parts.GetHashCode (); + if ( this.uploadKey != null ) + hash = hash * 59 + this.uploadKey.GetHashCode (); + return (hash); + } + } + + } + + /// + /// Post PostBatchSignedS3UploadPayload Payload Body Structure + /// + [DataContract] + public partial class PostBatchSignedS3UploadPayload : IEquatable { + + [DataMember (Name = "requests", EmitDefaultValue = false)] + public List requests { get; set; } + + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PostBatchSignedS3UploadPayload () { } + + public PostBatchSignedS3UploadPayload (PostBatchSignedS3UploadPayloadItem item = null) { + this.requests = new List () { item }; + } + + public PostBatchSignedS3UploadPayload (List items = null) { + if ( items == null ) + items = new List (); + //throw new InvalidDataException ("items is a required property for PostBatchSignedS3UploadPayload and cannot be null"); + this.requests = items; + } + + public override string ToString () { + var sb = new StringBuilder (); + sb.Append ("class PostBatchSignedS3UploadPayload {\n"); + sb.Append (" requests: ").Append (requests).Append ("\n"); + sb.Append ("}\n"); + return (sb.ToString ()); + } + + public string ToJson () { + return (JsonConvert.SerializeObject (this, Formatting.Indented)); + } + + public override bool Equals (object obj) { + // credit: http://stackoverflow.com/a/10454552/677735 + return (this.Equals (obj as PostBatchSignedS3UploadPayload)); + } + + /// + /// Returns true if PostBatchSignedS3UploadPayload instances are equal + /// + /// Instance of PostBatchSignedS3UploadPayload to be compared + /// Boolean + public bool Equals (PostBatchSignedS3UploadPayload other) { + // credit: http://stackoverflow.com/a/10454552/677735 + if ( other == null ) + return (false); + + return ( + ( + this.requests == other.requests || + this.requests != null && + this.requests.SequenceEqual (other.requests) + ) + ); + } + + public override int GetHashCode () { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if ( this.requests != null ) + hash = hash * 59 + this.requests.GetHashCode (); + return (hash); + } + } + + } + +} + diff --git a/Autodesk.Forge/Model/PostBatchSignedS3UploadResponse.cs b/Autodesk.Forge/Model/PostBatchSignedS3UploadResponse.cs new file mode 100644 index 0000000..a60a583 --- /dev/null +++ b/Autodesk.Forge/Model/PostBatchSignedS3UploadResponse.cs @@ -0,0 +1,122 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Autodesk.Forge.Model { + + /// + /// Post PostBatchSignedS3UploadResponseItem Payload Body Structure + /// + [DataContract] + public partial class PostBatchSignedS3UploadResponseItem { + + [DataMember (Name = "uploadKey", EmitDefaultValue = false)] + public string uploadKey { get; set; } + + [DataMember (Name = "uploadExpiration", EmitDefaultValue = false)] + public string uploadExpiration { get; set; } + + [DataMember (Name = "urlExpiration", EmitDefaultValue = false)] + public string urlExpiration { get; set; } + + [DataMember (Name = "urls", EmitDefaultValue = false)] + public string[] urls { get; set; } + + [DataMember (Name = "status", EmitDefaultValue = false)] + public string status { get; set; } + + [DataMember (Name = "reason", EmitDefaultValue = false)] + public string reason { get; set; } + + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PostBatchSignedS3UploadResponseItem () { } + + public PostBatchSignedS3UploadResponseItem ( + string uploadKey, + string uploadExpiration, + string urlExpiration, + string[] urls, + string status, + string reason + ) { + this.uploadKey = uploadKey; + this.uploadExpiration = uploadExpiration; + this.urlExpiration = urlExpiration; + this.urls = urls; + this.status = status; + this.reason = reason; + + } + + public string ToJson () { + return (JsonConvert.SerializeObject (this, Formatting.Indented)); + } + + } + + /// + /// Post PostBatchSignedS3UploadResponse Payload Body Structure + /// + [DataContract] + public partial class PostBatchSignedS3UploadResponse { + + [DataMember (Name = "results", EmitDefaultValue = false)] + public PostBatchSignedS3UploadResponseItem[] results { get; set; } + + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PostBatchSignedS3UploadResponse () { } + + public PostBatchSignedS3UploadResponse (PostBatchSignedS3UploadResponseItem item = null) { + this.results = new PostBatchSignedS3UploadResponseItem [1] { item }; + } + + public PostBatchSignedS3UploadResponse (PostBatchSignedS3UploadResponseItem [] items = null) { + if ( items == null ) + items = new PostBatchSignedS3UploadResponseItem [0]; + //throw new InvalidDataException ("items is a required property for PostBatchSignedS3UploadResponse and cannot be null"); + this.results = items; + } + + public string ToJson () { + return (JsonConvert.SerializeObject (this, Formatting.Indented)); + } + + } + +} + diff --git a/Autodesk.Forge/Model/PostBucketsPayload.cs b/Autodesk.Forge/Model/PostBucketsPayload.cs new file mode 100644 index 0000000..cc124c4 --- /dev/null +++ b/Autodesk.Forge/Model/PostBucketsPayload.cs @@ -0,0 +1,208 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Autodesk.Forge.Model +{ + /// + /// Bucket Payload Body Structure + /// + [DataContract] + public partial class PostBucketsPayload : IEquatable + { + /// + /// [Data retention policy](https://developer.autodesk.com/en/docs/data/v2/overview/retention-policy/) Acceptable values: `transient`, `temporary` or `persistent` + /// + /// [Data retention policy](https://developer.autodesk.com/en/docs/data/v2/overview/retention-policy/) Acceptable values: `transient`, `temporary` or `persistent` + [JsonConverter(typeof(StringEnumConverter))] + public enum PolicyKeyEnum + { + + /// + /// Enum Transient for "transient" + /// + [EnumMember(Value = "transient")] + Transient, + + /// + /// Enum Temporary for "temporary" + /// + [EnumMember(Value = "temporary")] + Temporary, + + /// + /// Enum Persistent for "persistent" + /// + [EnumMember(Value = "persistent")] + Persistent + } + + /// + /// [Data retention policy](https://developer.autodesk.com/en/docs/data/v2/overview/retention-policy/) Acceptable values: `transient`, `temporary` or `persistent` + /// + /// [Data retention policy](https://developer.autodesk.com/en/docs/data/v2/overview/retention-policy/) Acceptable values: `transient`, `temporary` or `persistent` + [DataMember(Name="policyKey", EmitDefaultValue=false)] + public PolicyKeyEnum? PolicyKey { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PostBucketsPayload() { } + /// + /// Initializes a new instance of the class. + /// + /// Bucket key (required). + /// . + /// [Data retention policy](https://developer.autodesk.com/en/docs/data/v2/overview/retention-policy/) Acceptable values: `transient`, `temporary` or `persistent` (required). + public PostBucketsPayload(string BucketKey = null, List Allow = null, PolicyKeyEnum? PolicyKey = null) + { + // to ensure "BucketKey" is required (not null) + if (BucketKey == null) + { + throw new InvalidDataException("BucketKey is a required property for PostBucketsPayload and cannot be null"); + } + else + { + this.BucketKey = BucketKey; + } + // to ensure "PolicyKey" is required (not null) + if (PolicyKey == null) + { + throw new InvalidDataException("PolicyKey is a required property for PostBucketsPayload and cannot be null"); + } + else + { + this.PolicyKey = PolicyKey; + } + this.Allow = Allow; + } + + /// + /// Bucket key + /// + /// Bucket key + [DataMember(Name="bucketKey", EmitDefaultValue=false)] + public string BucketKey { get; set; } + /// + /// + /// + /// + [DataMember(Name="allow", EmitDefaultValue=false)] + public List Allow { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class PostBucketsPayload {\n"); + sb.Append(" BucketKey: ").Append(BucketKey).Append("\n"); + sb.Append(" Allow: ").Append(Allow).Append("\n"); + sb.Append(" PolicyKey: ").Append(PolicyKey).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as PostBucketsPayload); + } + + /// + /// Returns true if PostBucketsPayload instances are equal + /// + /// Instance of PostBucketsPayload to be compared + /// Boolean + public bool Equals(PostBucketsPayload other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.BucketKey == other.BucketKey || + this.BucketKey != null && + this.BucketKey.Equals(other.BucketKey) + ) && + ( + this.Allow == other.Allow || + this.Allow != null && + this.Allow.SequenceEqual(other.Allow) + ) && + ( + this.PolicyKey == other.PolicyKey || + this.PolicyKey != null && + this.PolicyKey.Equals(other.PolicyKey) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if (this.BucketKey != null) + hash = hash * 59 + this.BucketKey.GetHashCode(); + if (this.Allow != null) + hash = hash * 59 + this.Allow.GetHashCode(); + if (this.PolicyKey != null) + hash = hash * 59 + this.PolicyKey.GetHashCode(); + return hash; + } + } + } + +} + diff --git a/Autodesk.Forge/Model/PostBucketsPayloadAllow.cs b/Autodesk.Forge/Model/PostBucketsPayloadAllow.cs new file mode 100644 index 0000000..5fdf1a8 --- /dev/null +++ b/Autodesk.Forge/Model/PostBucketsPayloadAllow.cs @@ -0,0 +1,186 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Autodesk.Forge.Model +{ + /// + /// PostBucketsPayloadAllow + /// + [DataContract] + public partial class PostBucketsPayloadAllow : IEquatable + { + /// + /// Acceptable values: `full` or `read` + /// + /// Acceptable values: `full` or `read` + [JsonConverter(typeof(StringEnumConverter))] + public enum AccessEnum + { + + /// + /// Enum Full for "full" + /// + [EnumMember(Value = "full")] + Full, + + /// + /// Enum Read for "read" + /// + [EnumMember(Value = "read")] + Read + } + + /// + /// Acceptable values: `full` or `read` + /// + /// Acceptable values: `full` or `read` + [DataMember(Name="access", EmitDefaultValue=false)] + public AccessEnum? Access { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PostBucketsPayloadAllow() { } + /// + /// Initializes a new instance of the class. + /// + /// The application key to grant access to (required). + /// Acceptable values: `full` or `read` (required). + public PostBucketsPayloadAllow(string AuthId = null, AccessEnum? Access = null) + { + // to ensure "AuthId" is required (not null) + if (AuthId == null) + { + throw new InvalidDataException("AuthId is a required property for PostBucketsPayloadAllow and cannot be null"); + } + else + { + this.AuthId = AuthId; + } + // to ensure "Access" is required (not null) + if (Access == null) + { + throw new InvalidDataException("Access is a required property for PostBucketsPayloadAllow and cannot be null"); + } + else + { + this.Access = Access; + } + } + + /// + /// The application key to grant access to + /// + /// The application key to grant access to + [DataMember(Name="authId", EmitDefaultValue=false)] + public string AuthId { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class PostBucketsPayloadAllow {\n"); + sb.Append(" AuthId: ").Append(AuthId).Append("\n"); + sb.Append(" Access: ").Append(Access).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as PostBucketsPayloadAllow); + } + + /// + /// Returns true if PostBucketsPayloadAllow instances are equal + /// + /// Instance of PostBucketsPayloadAllow to be compared + /// Boolean + public bool Equals(PostBucketsPayloadAllow other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.AuthId == other.AuthId || + this.AuthId != null && + this.AuthId.Equals(other.AuthId) + ) && + ( + this.Access == other.Access || + this.Access != null && + this.Access.Equals(other.Access) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if (this.AuthId != null) + hash = hash * 59 + this.AuthId.GetHashCode(); + if (this.Access != null) + hash = hash * 59 + this.Access.GetHashCode(); + return hash; + } + } + } + +} + diff --git a/Autodesk.Forge/Model/PostBucketsSigned.cs b/Autodesk.Forge/Model/PostBucketsSigned.cs new file mode 100644 index 0000000..8e34bcd --- /dev/null +++ b/Autodesk.Forge/Model/PostBucketsSigned.cs @@ -0,0 +1,141 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Autodesk.Forge.Model { + /// + /// PostBucketsSigned + /// + [DataContract] + public partial class PostBucketsSigned : IEquatable { + + /// + /// Expiration time in minutes Default value: 60 + /// + /// Expiration time in minutes Default value: 60 + [DataMember (Name = "minutesExpiration", EmitDefaultValue = false)] + public int? MinutesExpiration { get; set; } + + [DataMember (Name = "singleUse", EmitDefaultValue = false)] + public bool SingleUse { get; set; } + + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PostBucketsSigned () { } + + /// + /// Initializes a new instance of the class. + /// + /// Expiration time in minutes Default value: 60 (required) (default to 60). + public PostBucketsSigned (int? MinutesExpiration = null, bool singleUse = false) { + this.MinutesExpiration = MinutesExpiration == null ? 60 : MinutesExpiration; + this.SingleUse = singleUse; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString () { + var sb = new StringBuilder (); + sb.Append ("class PostBucketsSigned {\n"); + sb.Append (" MinutesExpiration: ").Append (MinutesExpiration).Append ("\n"); + sb.Append (" SingleUse: ").Append (SingleUse).Append ("\n"); + sb.Append ("}\n"); + return (sb.ToString ()); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson () { + return (JsonConvert.SerializeObject (this, Formatting.Indented)); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals (object obj) { + // credit: http://stackoverflow.com/a/10454552/677735 + return (this.Equals (obj as PostBucketsSigned)); + } + + /// + /// Returns true if PostBucketsSigned instances are equal + /// + /// Instance of PostBucketsSigned to be compared + /// Boolean + public bool Equals (PostBucketsSigned other) { + // credit: http://stackoverflow.com/a/10454552/677735 + if ( other == null ) + return (false); + + return ( + ( + this.MinutesExpiration == other.MinutesExpiration || + this.MinutesExpiration != null && + this.MinutesExpiration.Equals (other.MinutesExpiration) + ) + && + ( + this.SingleUse == other.SingleUse && //|| + //this.SingleUse != null && + this.SingleUse.Equals (other.SingleUse) + ) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode () { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if ( this.MinutesExpiration != null ) + hash = hash * 59 + this.MinutesExpiration.GetHashCode (); + hash = hash * 59 + this.SingleUse.GetHashCode (); + return (hash); + } + } + } + +} + diff --git a/Autodesk.Forge/Model/PostCompleteS3UploadPayload.cs b/Autodesk.Forge/Model/PostCompleteS3UploadPayload.cs new file mode 100644 index 0000000..adc877d --- /dev/null +++ b/Autodesk.Forge/Model/PostCompleteS3UploadPayload.cs @@ -0,0 +1,134 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Autodesk.Forge.Model { + + /// + /// Post PostCompleteS3UploadPayload Payload Body Structure + /// + [DataContract] + public partial class PostCompleteS3UploadPayload : IEquatable { + + [DataMember (Name = "uploadKey", EmitDefaultValue = false)] + public string uploadKey { get; set; } + + [DataMember (Name = "size", EmitDefaultValue = false)] + public int? size { get; set; } + + [DataMember (Name = "eTags", EmitDefaultValue = false)] + public List eTags { get; set; } + + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PostCompleteS3UploadPayload () { } + + public PostCompleteS3UploadPayload (string uploadKey, int? size, List eTags = null) { + if ( String.IsNullOrEmpty (uploadKey) ) + throw new InvalidDataException ("uploadKey is a required property for PostCompleteS3UploadPayload and cannot be null or empty"); + this.uploadKey = uploadKey; + this.size = size; + this.eTags = eTags; + } + + public override string ToString () { + var sb = new StringBuilder (); + sb.Append ("class PostCompleteS3UploadPayload {\n"); + sb.Append (" uploadKey: ").Append (uploadKey).Append ("\n"); + sb.Append (" size: ").Append (size).Append ("\n"); + sb.Append (" eTags: ").Append (eTags).Append ("\n"); + sb.Append ("}\n"); + return (sb.ToString ()); + } + + public string ToJson () { + return (JsonConvert.SerializeObject (this, Formatting.Indented)); + } + + public override bool Equals (object obj) { + // credit: http://stackoverflow.com/a/10454552/677735 + return (this.Equals (obj as PostCompleteS3UploadPayload)); + } + + /// + /// Returns true if PostCompleteS3UploadPayload instances are equal + /// + /// Instance of PostCompleteS3UploadPayload to be compared + /// Boolean + public bool Equals (PostCompleteS3UploadPayload other) { + // credit: http://stackoverflow.com/a/10454552/677735 + if ( other == null ) + return (false); + + return ( + ( + this.uploadKey == other.uploadKey || + this.uploadKey != null && + this.uploadKey.Equals (other.uploadKey) + ) + && + ( + this.size == other.size || + this.size != null && + this.size.Equals (other.size) + ) + && + ( + this.eTags == other.eTags || + this.eTags != null && + this.eTags.SequenceEqual (other.eTags) + ) + ); + } + + public override int GetHashCode () { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if ( this.uploadKey != null ) + hash = hash * 59 + this.uploadKey.GetHashCode (); + if ( this.size != null ) + hash = hash * 59 + this.size.GetHashCode (); + if ( this.eTags != null ) + hash = hash * 59 + this.eTags.GetHashCode (); + return (hash); + } + } + + } + +} + diff --git a/Autodesk.Forge/Model/PostObjectSigned.cs b/Autodesk.Forge/Model/PostObjectSigned.cs new file mode 100644 index 0000000..edbd1e8 --- /dev/null +++ b/Autodesk.Forge/Model/PostObjectSigned.cs @@ -0,0 +1,165 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Autodesk.Forge.Model +{ + /// + /// Object Signed Object json response + /// + [DataContract] + public partial class PostObjectSigned : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PostObjectSigned() { } + /// + /// Initializes a new instance of the class. + /// + /// URL created for downloading the object (required). + /// Value for expiration in minutes (required). + public PostObjectSigned(string SignedUrl = null, long? Expiration = null) + { + // to ensure "SignedUrl" is required (not null) + if (SignedUrl == null) + { + throw new InvalidDataException("SignedUrl is a required property for PostObjectSigned and cannot be null"); + } + else + { + this.SignedUrl = SignedUrl; + } + // to ensure "Expiration" is required (not null) + if (Expiration == null) + { + throw new InvalidDataException("Expiration is a required property for PostObjectSigned and cannot be null"); + } + else + { + this.Expiration = Expiration; + } + } + + /// + /// URL created for downloading the object + /// + /// URL created for downloading the object + [DataMember(Name="signedUrl", EmitDefaultValue=false)] + public string SignedUrl { get; set; } + /// + /// Value for expiration in minutes + /// + /// Value for expiration in minutes + [DataMember(Name="expiration", EmitDefaultValue=false)] + public long? Expiration { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class PostObjectSigned {\n"); + sb.Append(" SignedUrl: ").Append(SignedUrl).Append("\n"); + sb.Append(" Expiration: ").Append(Expiration).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as PostObjectSigned); + } + + /// + /// Returns true if PostObjectSigned instances are equal + /// + /// Instance of PostObjectSigned to be compared + /// Boolean + public bool Equals(PostObjectSigned other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.SignedUrl == other.SignedUrl || + this.SignedUrl != null && + this.SignedUrl.Equals(other.SignedUrl) + ) && + ( + this.Expiration == other.Expiration || + this.Expiration != null && + this.Expiration.Equals(other.Expiration) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if (this.SignedUrl != null) + hash = hash * 59 + this.SignedUrl.GetHashCode(); + if (this.Expiration != null) + hash = hash * 59 + this.Expiration.GetHashCode(); + return hash; + } + } + } + +} + diff --git a/Autodesk.Forge/Model/Scope.cs b/Autodesk.Forge/Model/Scope.cs new file mode 100644 index 0000000..c4cdb6b --- /dev/null +++ b/Autodesk.Forge/Model/Scope.cs @@ -0,0 +1,112 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma warning disable 1591 +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using RestSharp; +using System.ComponentModel; +using System.Reflection; + +namespace Autodesk.Forge +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false)] + public class ForgeScopeAttribute : Attribute { + + public ForgeScopeAttribute (string val) { + this.Scope =val ; + } + + public virtual string Scope { get; set; } + + } + + public enum Scope { + [ForgeScope ("data:read")] + [Description ("The application will be able to read the end user’s data within the Autodesk ecosystem.")] + DataRead, + [ForgeScope ("data:write")] + [Description ("The application will be able to create, update, and delete data on behalf of the end user within the Autodesk ecosystem.")] + DataWrite, + [ForgeScope ("data:create")] + [Description ("The application will be able to create data on behalf of the end user within the Autodesk ecosystem.")] + DataCreate, + [ForgeScope ("data:search")] + [Description ("The application will be able to search the end user’s data within the Autodesk ecosystem.")] + DataSearch, + [ForgeScope ("bucket:create")] + [Description ("The application will be able to create an OSS bucket it will own.")] + BucketCreate, + [ForgeScope ("bucket:read")] + [Description ("The application will be able to read the metadata and list contents for OSS buckets that it has access to.")] + BucketRead, + [ForgeScope ("bucket:update")] + [Description ("The application will be able to set permissions and entitlements for OSS buckets that it has permission to modify.")] + BucketUpdate, + [ForgeScope ("bucket:delete")] + [Description ("The application will be able to delete a bucket that it has permission to delete.")] + BucketDelete, + [ForgeScope ("code:all")] + [Description ("The application will be able to author and execute code on behalf of the end user (e.g., scripts processed by the Design Automation API).")] + CodeAll, + [ForgeScope ("account:read")] + [Description ("For Product APIs, the application will be able to read the account data the end user has entitlements to.")] + AccountRead, + [ForgeScope ("account:write")] + [Description ("For Product APIs, the application will be able to update the account data the end user has entitlements to.")] + AccountWrite, + [ForgeScope ("user-profile:read")] + [Description ("The application will be able to read the end user’s profile data.")] + UserProfileRead, + [ForgeScope ("viewables:read")] + [Description ("The application will have read access to viewable resources such as thumbnails. This scope is a subset of data:read.")] + ViewablesRead + } + + public static class ForgeScopeExtensions { + + public static string AsString (this T me) where T : struct { + Type type =me.GetType () ; + if ( !type.IsEnum ) + throw new ArgumentException ("Value must be of Enum type", "me") ; + MemberInfo [] memberInfo =type.GetMember (me.ToString ()) ; + if ( memberInfo != null && memberInfo.Length > 0 ) { + object [] attrs =memberInfo [0].GetCustomAttributes (typeof (ForgeScopeAttribute), false) ; + if ( attrs != null && attrs.Length > 0 ) + return (((ForgeScopeAttribute)attrs [0]).Scope) ; + } + return (me.ToString ()) ; + } + + public static string AsString (this T[] me) where T : struct { + List results =new List () ; + foreach ( T item in me ) + results.Add (item.AsString ()) ; + return (string.Join (" ", results.ToArray ())) ; + } + + } + +} +#pragma warning restore 1591 diff --git a/Autodesk.Forge/Model/UploadItemDesc.cs b/Autodesk.Forge/Model/UploadItemDesc.cs new file mode 100644 index 0000000..90f7301 --- /dev/null +++ b/Autodesk.Forge/Model/UploadItemDesc.cs @@ -0,0 +1,139 @@ +/* + * Forge SDK + * + * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering. + * + + * Contact: forge.help@autodesk.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Autodesk.Forge.Model { + + public delegate void UploadItemsCallBack (float progress, TimeSpan elapsed, List objects); + + /// + /// Post UploadItemDesc Payload Body Structure + /// + public partial class UploadItemDesc { + + public string objectKey { get; set; } + public string uploadKey { get; set; } + public List eTags { get; set; } + public string xAdsMetaContentType { get; set; } + public string xAdsMetaContentDisposition { get; set; } + public string xAdsMetaContentEncoding { get; set; } + public string xAdsMetaCacheControl { get; set; } + + protected Stream dataStream = null; + protected byte [] dataBytes = null; + public dynamic data { + get { + if ( dataStream != null ) + return (dataStream); + else + return (dataBytes); + } + set { + if ( value is Stream ) + dataStream = value; + else if ( value is string ) + dataBytes = Encoding.UTF8.GetBytes (value); + else + dataBytes = value; + } + } + public long Length { + get { + if ( dataBytes != null ) + return ((long)dataBytes.Length); + if ( dataStream != null ) + return (dataStream.Length); + return (0); + } + } + public bool isStream { get { return (dataStream != null); } } + + public float Progress { get; set; } + public List uploadUrls { get; set; } + public dynamic uploads { get; set; } + public dynamic completedResponse { get; set; } + public dynamic completed { get; set; } + + public bool Error { get; set; } + + /// + /// Initializes a new instance of the class. + /// + protected UploadItemDesc () { } + + public UploadItemDesc ( + string objectKey, + dynamic data = null, + string xAdsMetaContentType = null, + string xAdsMetaContentDisposition = null, + string xAdsMetaContentEncoding = null, + string xAdsMetaCacheControl = null + ) { + if ( objectKey == null ) + throw new InvalidDataException ("objectKey is a required property for UploadItemDesc and cannot be null"); + if ( data == null ) + throw new InvalidDataException ("data is a required property for UploadItemDesc and cannot be null"); + this.objectKey = objectKey; + this.data = data; + this.uploadKey = null; + + this.xAdsMetaContentType = xAdsMetaContentType; + this.xAdsMetaContentDisposition = xAdsMetaContentDisposition; + this.xAdsMetaContentEncoding = xAdsMetaContentEncoding; + this.xAdsMetaCacheControl = xAdsMetaCacheControl; + } + + public byte[] chunk { get; set; } + + public byte[] Chunk (long start, long length) { + //return (dataBytes.Skip(start).Take(length).ToArray()); // slow + byte[] chunk = new byte [length]; + Array.Copy (dataBytes, start, chunk, 0, length); + return (chunk); + } + + public override string ToString () { + var sb = new StringBuilder (); + sb.Append ("UploadItemDesc {"); + sb.Append (" objectKey: \"").Append (objectKey).Append ("\","); + sb.Append (" uploadKey: \"").Append (uploadKey).Append ("\","); + sb.Append (" eTags: [").Append (eTags != null ? string.Join (", ", eTags) : "").Append ("],"); + sb.Append (" Progress: ").Append (Progress).Append (","); + sb.Append (" completed: ").Append (completed != null ? completed.ToString() : "null"); + sb.Append ("}\n"); + return (sb.ToString ()); + } + + } + +} + diff --git a/Autodesk.Forge/README.md b/Autodesk.Forge/README.md new file mode 100644 index 0000000..c025045 --- /dev/null +++ b/Autodesk.Forge/README.md @@ -0,0 +1,18 @@ +# Autodesk.Forge + +`Autodesk.Forge` is a copy from the original `forge-api-dotnet-client` repository. +* https://github.com/Autodesk-Forge/forge-api-dotnet-client + +> This repository has been deprecated. For the new APS SDK for .NET please refer to https://github.com/autodesk-platform-services/aps-sdk-net. + +## AssemblyName +The assembly name was changed to `ricaun.Autodesk.Forge`. + +### Changes + +Only copy the following classes and dependencies: + * `BucketsApi` + * `ObjectsApi` + * `TwoLeggedApi` + +--- \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e17ca71..842ec16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [3.0.0] / 2024-12-13 +### Features +- Create `Autodesk.Forge` internal project. +### Autodesk.Forge +- Copy `BucketsApi`, `ObjectsApi`, `TwoLeggedApi` from the original `forge-api-dotnet-client` repository. + ## [2.1.0] / 2024-12-12 ### Updated - Remove obsolete endpoints and use `S3`. @@ -32,6 +38,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Add `Autodesk.Forge.Oss.Tests` project [vNext]: ../../compare/1.0.0...HEAD +[3.0.0]: ../../compare/2.1.0...3.0.0 [2.1.0]: ../../compare/2.0.0...2.1.0 [2.0.0]: ../../compare/1.0.2...2.0.0 [1.0.2]: ../../compare/1.0.1...1.0.2 From d1dac7389a2c30329771a5b0cdabdb4ecba1751f Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Fri, 13 Dec 2024 14:27:31 -0300 Subject: [PATCH 02/10] Update Version --- Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj | 2 +- Autodesk.Forge/Client/Configuration.cs | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj b/Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj index 3d4f393..ab668e2 100644 --- a/Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj +++ b/Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj @@ -55,7 +55,7 @@ ricaun.Autodesk.Forge.Oss - 2.2.0-alpha + 3.0.0-alpha {54AC7247-0A9C-4A56-835B-D1790800647B} diff --git a/Autodesk.Forge/Client/Configuration.cs b/Autodesk.Forge/Client/Configuration.cs index 16e6957..987b94c 100644 --- a/Autodesk.Forge/Client/Configuration.cs +++ b/Autodesk.Forge/Client/Configuration.cs @@ -34,10 +34,9 @@ namespace Autodesk.Forge.Client { /// Represents a set of configuration settings /// public class Configuration { - public static int DefaultTimeout = 100000; - public static string DefaultUserAgent = "forge-apis/2.0.0 (.net)"; - public const string Version = "2.000"; + public static string DefaultUserAgent { get; } = $"forge-apis/{Version} (.net)"; + public static string Version { get; } = typeof(Configuration).Assembly.GetName().Version.ToString(3); /// /// Gets or sets the default Configuration. @@ -159,7 +158,7 @@ public Configuration ( if ( timeout == 0 ) timeout = DefaultTimeout; if ( userAgent == null ) - userAgent = "forge-apis/" + Version + " (.net)"; + userAgent = DefaultUserAgent; setApiClientUsingDefault (apiClient); From c9f326444b097cab96b83d6984895831fab75578 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Fri, 13 Dec 2024 14:50:08 -0300 Subject: [PATCH 03/10] Update deprecated `x-ads-region` to `region` when creating a bucket. --- Autodesk.Forge.Oss.Tests/BucketApiTests.cs | 34 +++++++++++++ Autodesk.Forge.Oss/OssClient.cs | 12 ++--- Autodesk.Forge/Api/BucketsApi.cs | 56 +++++++++++----------- CHANGELOG.md | 3 ++ 4 files changed, 71 insertions(+), 34 deletions(-) diff --git a/Autodesk.Forge.Oss.Tests/BucketApiTests.cs b/Autodesk.Forge.Oss.Tests/BucketApiTests.cs index 35fb51a..b441ba7 100644 --- a/Autodesk.Forge.Oss.Tests/BucketApiTests.cs +++ b/Autodesk.Forge.Oss.Tests/BucketApiTests.cs @@ -1,5 +1,7 @@ +using Autodesk.Forge.Client; using NUnit.Framework; using System; +using System.IO; using System.Threading.Tasks; namespace Autodesk.Forge.Oss.Tests @@ -32,6 +34,38 @@ public async Task BucketApi_CreateAndDelete() Assert.IsNull(await OssClient.TryGetBucketDetailsAsync(BucketKey)); } + [TestCase("US")] + [TestCase("EMEA")] + [TestCase("AUS")] + public async Task BucketApi_CreateAndDelete_Region(string region) + { + var bucketKey = $"{BucketKey}_{region}".ToLower(); + var bucketCreated = await OssClient.CreateBucketAsync(bucketKey, region: region); + Assert.AreEqual(bucketKey, bucketCreated.BucketKey); + Assert.IsNotNull(await OssClient.GetBucketDetailsAsync(bucketKey)); + + + // Test file in the region + { + var ObjectName = TestFactory.CreateObjectName(); + var DataString = TestFactory.CreateDataString(); + File.WriteAllText(ObjectName, DataString); + var fileDetail = await OssClient.UploadFileAsync(bucketKey, ObjectName, ObjectName); + Assert.AreEqual(DataString.Length, fileDetail.Size); + + var objectDetails = await OssClient.GetObjectDetailsAsync(bucketKey, ObjectName); + Assert.AreEqual(DataString.Length, objectDetails.Size); + + await OssClient.DeleteObjectAsync(bucketKey, ObjectName); + Assert.ThrowsAsync(() => OssClient.GetObjectDetailsAsync(bucketKey, ObjectName)); + + File.Delete(ObjectName); + } + + await OssClient.DeleteBucketAsync(bucketKey); + Assert.IsNull(await OssClient.TryGetBucketDetailsAsync(bucketKey)); + } + [Ignore("Skip Delete Buckets")] [Test] public async Task BucketApi_DeleteAll() diff --git a/Autodesk.Forge.Oss/OssClient.cs b/Autodesk.Forge.Oss/OssClient.cs index 371d529..8097665 100644 --- a/Autodesk.Forge.Oss/OssClient.cs +++ b/Autodesk.Forge.Oss/OssClient.cs @@ -105,16 +105,16 @@ public async Task DeleteBucketAsync(string bucketKey) /// Bucket key (required). /// . /// [Data retention policy](https://developer.autodesk.com/en/docs/data/v2/overview/retention-policy/) Acceptable values: `transient`, `temporary` or `persistent` (required). - /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) /// public async Task CreateBucketAsync( string bucketKey, List allow = null, PostBucketsPayload.PolicyKeyEnum policyKey = PostBucketsPayload.PolicyKeyEnum.Transient, - string xAdsRegion = null) + string region = null) { var postBuckets = new PostBucketsPayload(bucketKey, allow, policyKey); - return await this.CreateBucketAsync(postBuckets, xAdsRegion); + return await this.CreateBucketAsync(postBuckets, region); } /// @@ -122,11 +122,11 @@ public async Task CreateBucketAsync( /// /// Thrown when fails to make API call /// Body Structure - /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) /// Task of Bucket - public async Task CreateBucketAsync(PostBucketsPayload postBuckets, string xAdsRegion = null) + public async Task CreateBucketAsync(PostBucketsPayload postBuckets, string region = null) { - var value = await BucketsApi.CreateBucketAsync(postBuckets, xAdsRegion) as DynamicJsonResponse; + var value = await BucketsApi.CreateBucketAsync(postBuckets, region) as DynamicJsonResponse; return value.ToObject(); } #endregion diff --git a/Autodesk.Forge/Api/BucketsApi.cs b/Autodesk.Forge/Api/BucketsApi.cs index 77e9ab0..093548b 100644 --- a/Autodesk.Forge/Api/BucketsApi.cs +++ b/Autodesk.Forge/Api/BucketsApi.cs @@ -43,10 +43,10 @@ public interface IBucketsApi : IApiAccessor { /// /// Thrown when fails to make API call /// Body Structure - /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) /// Bucket /*Bucket*/ - dynamic CreateBucket (PostBucketsPayload postBuckets, string xAdsRegion = null); + dynamic CreateBucket (PostBucketsPayload postBuckets, string region = null); /// /// @@ -56,9 +56,9 @@ public interface IBucketsApi : IApiAccessor { /// /// Thrown when fails to make API call /// Body Structure - /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) /// ApiResponse of Bucket - ApiResponse CreateBucketWithHttpInfo (PostBucketsPayload postBuckets, string xAdsRegion = null); + ApiResponse CreateBucketWithHttpInfo (PostBucketsPayload postBuckets, string region = null); /// /// /// @@ -138,9 +138,9 @@ public interface IBucketsApi : IApiAccessor { /// /// Thrown when fails to make API call /// Body Structure - /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) /// Task of Bucket - System.Threading.Tasks.Task CreateBucketAsync (PostBucketsPayload postBuckets, string xAdsRegion = null); + System.Threading.Tasks.Task CreateBucketAsync (PostBucketsPayload postBuckets, string region = null); /// /// @@ -150,9 +150,9 @@ public interface IBucketsApi : IApiAccessor { /// /// Thrown when fails to make API call /// Body Structure - /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) /// Task of ApiResponse (Bucket) - System.Threading.Tasks.Task> CreateBucketAsyncWithHttpInfo (PostBucketsPayload postBuckets, string xAdsRegion = null); + System.Threading.Tasks.Task> CreateBucketAsyncWithHttpInfo (PostBucketsPayload postBuckets, string region = null); /// /// @@ -230,8 +230,8 @@ public interface IBucketsApi : IApiAccessor { /// Represents a collection of functions to interact with the API endpoints /// public partial class BucketsApi : IBucketsApi { - - private Autodesk.Forge.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + private const string HeaderParamRegion = "region"; + private Autodesk.Forge.Client.ExceptionFactory _exceptionFactory = (name, response) => null; /// /// Initializes a new instance of the class. @@ -329,10 +329,10 @@ public void AddDefaultHeader (string key, string value) { /// /// Thrown when fails to make API call /// Body Structure - /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) /// Bucket - public /*Bucket*/dynamic CreateBucket (PostBucketsPayload postBuckets, string xAdsRegion = null) { - ApiResponse localVarResponse = CreateBucketWithHttpInfo (postBuckets, xAdsRegion); + public /*Bucket*/dynamic CreateBucket (PostBucketsPayload postBuckets, string region = null) { + ApiResponse localVarResponse = CreateBucketWithHttpInfo (postBuckets, region); return localVarResponse.Data; } @@ -341,9 +341,9 @@ public void AddDefaultHeader (string key, string value) { /// /// Thrown when fails to make API call /// Body Structure - /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) /// ApiResponse of Bucket - public ApiResponse CreateBucketWithHttpInfo (PostBucketsPayload postBuckets, string xAdsRegion = null) { + public ApiResponse CreateBucketWithHttpInfo (PostBucketsPayload postBuckets, string region = null) { // verify the required parameter 'postBuckets' is set if ( postBuckets == null ) throw new ApiException (400, "Missing required parameter 'postBuckets' when calling BucketsApi->CreateBucket"); @@ -374,10 +374,10 @@ public void AddDefaultHeader (string key, string value) { // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add ("format", "json"); - if ( xAdsRegion != null && localVarHeaderParams.ContainsKey ("x-ads-region") ) - localVarHeaderParams ["x-ads-region"] = Configuration.ApiClient.ParameterToString (xAdsRegion); // header parameter - else if ( xAdsRegion != null ) - localVarHeaderParams.Add ("x-ads-region", Configuration.ApiClient.ParameterToString (xAdsRegion)); // header parameter + if ( region != null && localVarHeaderParams.ContainsKey (HeaderParamRegion) ) + localVarHeaderParams [HeaderParamRegion] = Configuration.ApiClient.ParameterToString (region); // header parameter + else if ( region != null ) + localVarHeaderParams.Add (HeaderParamRegion, Configuration.ApiClient.ParameterToString (region)); // header parameter if ( postBuckets != null && postBuckets.GetType () == typeof (byte []) ) // http body (model) parameter { localVarPostBody = postBuckets; // byte array @@ -426,10 +426,10 @@ public void AddDefaultHeader (string key, string value) { /// /// Thrown when fails to make API call /// Body Structure - /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) /// Task of Bucket - public async System.Threading.Tasks.Task CreateBucketAsync (PostBucketsPayload postBuckets, string xAdsRegion = null) { - ApiResponse localVarResponse = await CreateBucketAsyncWithHttpInfo (postBuckets, xAdsRegion); + public async System.Threading.Tasks.Task CreateBucketAsync (PostBucketsPayload postBuckets, string region = null) { + ApiResponse localVarResponse = await CreateBucketAsyncWithHttpInfo (postBuckets, region); return localVarResponse.Data; } @@ -439,9 +439,9 @@ public void AddDefaultHeader (string key, string value) { /// /// Thrown when fails to make API call /// Body Structure - /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) /// Task of ApiResponse (Bucket) - public async System.Threading.Tasks.Task> CreateBucketAsyncWithHttpInfo (PostBucketsPayload postBuckets, string xAdsRegion = null) { + public async System.Threading.Tasks.Task> CreateBucketAsyncWithHttpInfo (PostBucketsPayload postBuckets, string region = null) { // verify the required parameter 'postBuckets' is set if ( postBuckets == null ) throw new ApiException (400, "Missing required parameter 'postBuckets' when calling BucketsApi->CreateBucket"); @@ -472,10 +472,10 @@ public void AddDefaultHeader (string key, string value) { // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add ("format", "json"); - if ( xAdsRegion != null && localVarHeaderParams.ContainsKey ("x-ads-region") ) - localVarHeaderParams ["x-ads-region"] = Configuration.ApiClient.ParameterToString (xAdsRegion); // header parameter - else if (xAdsRegion != null ) - localVarHeaderParams.Add ("x-ads-region", Configuration.ApiClient.ParameterToString (xAdsRegion)); // header parameter + if ( region != null && localVarHeaderParams.ContainsKey (HeaderParamRegion) ) + localVarHeaderParams [HeaderParamRegion] = Configuration.ApiClient.ParameterToString (region); // header parameter + else if (region != null ) + localVarHeaderParams.Add (HeaderParamRegion, Configuration.ApiClient.ParameterToString (region)); // header parameter if ( postBuckets != null && postBuckets.GetType () == typeof (byte []) ) // http body (model) parameter { localVarPostBody = postBuckets; // byte array diff --git a/CHANGELOG.md b/CHANGELOG.md index 842ec16..85f7ed2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Create `Autodesk.Forge` internal project. ### Autodesk.Forge - Copy `BucketsApi`, `ObjectsApi`, `TwoLeggedApi` from the original `forge-api-dotnet-client` repository. +- Update deprecated `x-ads-region` to `region` when creating a bucket. [buckets-POST](https://aps.autodesk.com/en/docs/data/v2/reference/http/buckets-POST/) +### Tests +- Add `BucketApi_CreateAndDelete_Region` ## [2.1.0] / 2024-12-12 ### Updated From a9bd03b93964545e137b81f024f1192619770ae0 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Fri, 13 Dec 2024 15:06:11 -0300 Subject: [PATCH 04/10] Add ` Obsolete` --- Autodesk.Forge.Oss/OssClient.cs | 34 ++-- Autodesk.Forge/Api/ObjectsApi.cs | 260 ++++++++++++++++--------------- 2 files changed, 151 insertions(+), 143 deletions(-) diff --git a/Autodesk.Forge.Oss/OssClient.cs b/Autodesk.Forge.Oss/OssClient.cs index 8097665..03e5235 100644 --- a/Autodesk.Forge.Oss/OssClient.cs +++ b/Autodesk.Forge.Oss/OssClient.cs @@ -146,23 +146,23 @@ public async Task GetObjectsAsync(string bucketKey, int? limit = var value = await this.ObjectsApi.GetObjectsAsync(bucketKey, limit, beginsWith, startAt) as DynamicJsonResponse; return value.ToObject(); } - // /// - ///// Download an object. - ///// - ///// Thrown when fails to make API call - ///// URL-encoded bucket key - ///// URL-encoded object name - ///// A range of bytes to download from the specified object. (optional) - ///// The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. (optional) - ///// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) - ///// When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. (optional) - ///// Task of System.IO.Stream - //[Obsolete] - //public async Task GetObjectAsync(string bucketKey, string objectName, string range = null, string ifNoneMatch = null, DateTime? ifModifiedSince = null, string acceptEncoding = null) - //{ - // var value = await this.ObjectsApi.GetObjectAsync(bucketKey, objectName, range, ifNoneMatch, ifModifiedSince, acceptEncoding); - // return value as Stream; - //} + /// + /// Download an object. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// A range of bytes to download from the specified object. (optional) + /// The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. (optional) + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. (optional) + /// Task of System.IO.Stream + [Obsolete] + internal async Task GetObjectAsyncObsolete(string bucketKey, string objectName, string range = null, string ifNoneMatch = null, DateTime? ifModifiedSince = null, string acceptEncoding = null) + { + var value = await this.ObjectsApi.GetObjectAsync(bucketKey, objectName, range, ifNoneMatch, ifModifiedSince, acceptEncoding); + return value as Stream; + } /// /// GetObjectAsync using CreateSignedFileAsync and GetStreamAsync /// diff --git a/Autodesk.Forge/Api/ObjectsApi.cs b/Autodesk.Forge/Api/ObjectsApi.cs index fe5c78c..8876376 100644 --- a/Autodesk.Forge/Api/ObjectsApi.cs +++ b/Autodesk.Forge/Api/ObjectsApi.cs @@ -432,34 +432,36 @@ public interface IObjectsApi : IApiAccessor { /// ApiResponse of ObjectDetails ApiResponse UploadSignedResourcesChunkWithHttpInfo (string id, string contentRange, string sessionId, System.IO.Stream body, string contentDisposition = null, string xAdsRegion = null, string contentType = "application/octet-stream"); - #endregion Synchronous Operations - - #region Asynchronous Operations - /// - /// - /// - /// - /// Copies an object to another object name in the same bucket. - /// - /// Thrown when fails to make API call - /// URL-encoded bucket key - /// URL-encoded object name - /// URL-encoded Object key to use as the destination - /// Task of ObjectDetails - System.Threading.Tasks.Task CopyToAsync (string bucketKey, string objectName, string newObjName); - - /// - /// - /// - /// - /// Copies an object to another object name in the same bucket. - /// - /// Thrown when fails to make API call - /// URL-encoded bucket key - /// URL-encoded object name - /// URL-encoded Object key to use as the destination - /// Task of ApiResponse (ObjectDetails) - System.Threading.Tasks.Task> CopyToAsyncWithHttpInfo (string bucketKey, string objectName, string newObjName); + #endregion Synchronous Operations + + #region Asynchronous Operations + /// + /// + /// + /// + /// Copies an object to another object name in the same bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// URL-encoded Object key to use as the destination + /// Task of ObjectDetails + [Obsolete] + System.Threading.Tasks.Task CopyToAsync (string bucketKey, string objectName, string newObjName); + + /// + /// + /// + /// + /// Copies an object to another object name in the same bucket. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// URL-encoded Object key to use as the destination + /// Task of ApiResponse (ObjectDetails) + [Obsolete] + System.Threading.Tasks.Task> CopyToAsyncWithHttpInfo (string bucketKey, string objectName, string newObjName); /// /// @@ -539,37 +541,39 @@ public interface IObjectsApi : IApiAccessor { /// Task of ApiResponse System.Threading.Tasks.Task> DeleteSignedResourceAsyncWithHttpInfo (string id, string region = null); - /// - /// - /// - /// - /// Download an object. - /// - /// Thrown when fails to make API call - /// URL-encoded bucket key - /// URL-encoded object name - /// A range of bytes to download from the specified object. (optional) - /// The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. (optional) - /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) - /// When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. (optional) - /// Task of System.IO.Stream - System.Threading.Tasks.Task GetObjectAsync (string bucketKey, string objectName, string range = null, string ifNoneMatch = null, DateTime? ifModifiedSince = null, string acceptEncoding = null); - - /// - /// - /// - /// - /// Download an object. - /// - /// Thrown when fails to make API call - /// URL-encoded bucket key - /// URL-encoded object name - /// A range of bytes to download from the specified object. (optional) - /// The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. (optional) - /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) - /// When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. (optional) - /// Task of ApiResponse (System.IO.Stream) - System.Threading.Tasks.Task> GetObjectAsyncWithHttpInfo (string bucketKey, string objectName, string range = null, string ifNoneMatch = null, DateTime? ifModifiedSince = null, string acceptEncoding = null); + /// + /// + /// + /// + /// Download an object. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// A range of bytes to download from the specified object. (optional) + /// The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. (optional) + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. (optional) + /// Task of System.IO.Stream + [Obsolete] + System.Threading.Tasks.Task GetObjectAsync (string bucketKey, string objectName, string range = null, string ifNoneMatch = null, DateTime? ifModifiedSince = null, string acceptEncoding = null); + + /// + /// + /// + /// + /// Download an object. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// A range of bytes to download from the specified object. (optional) + /// The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. (optional) + /// If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. (optional) + /// When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. (optional) + /// Task of ApiResponse (System.IO.Stream) + [Obsolete] + System.Threading.Tasks.Task> GetObjectAsyncWithHttpInfo (string bucketKey, string objectName, string range = null, string ifNoneMatch = null, DateTime? ifModifiedSince = null, string acceptEncoding = null); /// /// @@ -685,73 +689,77 @@ public interface IObjectsApi : IApiAccessor { /// Task of ApiResponse System.Threading.Tasks.Task> GetStatusBySessionIdAsyncWithHttpInfo (string bucketKey, string objectName, string sessionId); - /// - /// - /// - /// - /// This endpoint allows resumable uploads for large files in chunks. - /// - /// Thrown when fails to make API call - /// URL-encoded bucket key - /// URL-encoded object name - /// Indicates the size of the request body. - /// Byte range of a segment being uploaded - /// Unique identifier of a session of a file being uploaded - /// - /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) - /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) - /// Task of ObjectDetails - System.Threading.Tasks.Task UploadChunkAsync (string bucketKey, string objectName, int? contentLength, string contentRange, string sessionId, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream"); - - /// - /// - /// - /// - /// This endpoint allows resumable uploads for large files in chunks. - /// - /// Thrown when fails to make API call - /// URL-encoded bucket key - /// URL-encoded object name - /// Indicates the size of the request body. - /// Byte range of a segment being uploaded - /// Unique identifier of a session of a file being uploaded - /// - /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) - /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) - /// Task of ApiResponse (ObjectDetails) - System.Threading.Tasks.Task> UploadChunkAsyncWithHttpInfo (string bucketKey, string objectName, int? contentLength, string contentRange, string sessionId, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream"); - - /// - /// - /// - /// - /// Upload an object. If the specified object name already exists in the bucket, the uploaded content will overwrite the existing content for the bucket name/object name combination. - /// - /// Thrown when fails to make API call - /// URL-encoded bucket key - /// URL-encoded object name - /// Indicates the size of the request body. - /// - /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) - /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) - /// Task of ObjectDetails - System.Threading.Tasks.Task UploadObjectAsync (string bucketKey, string objectName, int? contentLength, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream"); - - /// - /// - /// - /// - /// Upload an object. If the specified object name already exists in the bucket, the uploaded content will overwrite the existing content for the bucket name/object name combination. - /// - /// Thrown when fails to make API call - /// URL-encoded bucket key - /// URL-encoded object name - /// Indicates the size of the request body. - /// - /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) - /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) - /// Task of ApiResponse (ObjectDetails) - System.Threading.Tasks.Task> UploadObjectAsyncWithHttpInfo (string bucketKey, string objectName, int? contentLength, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream"); + /// + /// + /// + /// + /// This endpoint allows resumable uploads for large files in chunks. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Indicates the size of the request body. + /// Byte range of a segment being uploaded + /// Unique identifier of a session of a file being uploaded + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// Task of ObjectDetails + [Obsolete] + System.Threading.Tasks.Task UploadChunkAsync (string bucketKey, string objectName, int? contentLength, string contentRange, string sessionId, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream"); + + /// + /// + /// + /// + /// This endpoint allows resumable uploads for large files in chunks. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Indicates the size of the request body. + /// Byte range of a segment being uploaded + /// Unique identifier of a session of a file being uploaded + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// Task of ApiResponse (ObjectDetails) + [Obsolete] + System.Threading.Tasks.Task> UploadChunkAsyncWithHttpInfo (string bucketKey, string objectName, int? contentLength, string contentRange, string sessionId, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream"); + + /// + /// + /// + /// + /// Upload an object. If the specified object name already exists in the bucket, the uploaded content will overwrite the existing content for the bucket name/object name combination. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Indicates the size of the request body. + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// Task of ObjectDetails + [Obsolete] + System.Threading.Tasks.Task UploadObjectAsync (string bucketKey, string objectName, int? contentLength, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream"); + + /// + /// + /// + /// + /// Upload an object. If the specified object name already exists in the bucket, the uploaded content will overwrite the existing content for the bucket name/object name combination. + /// + /// Thrown when fails to make API call + /// URL-encoded bucket key + /// URL-encoded object name + /// Indicates the size of the request body. + /// + /// The suggested default filename when downloading this object to a file after it has been uploaded. (optional) + /// If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. (optional) + /// Task of ApiResponse (ObjectDetails) + [Obsolete] + System.Threading.Tasks.Task> UploadObjectAsyncWithHttpInfo (string bucketKey, string objectName, int? contentLength, System.IO.Stream body, string contentDisposition = null, string ifMatch = null, string contentType = "application/octet-stream"); /// /// From 3afb8ca463ecd6f2b3bef467707cfb8566bf84f1 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Fri, 13 Dec 2024 15:19:15 -0300 Subject: [PATCH 05/10] Update `CreateBucketAsync` to work with `region` --- Autodesk.Forge.Oss.Tests/BucketApiTests.cs | 2 +- Autodesk.Forge.Oss/OssClient.cs | 8 ++++---- CHANGELOG.md | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Autodesk.Forge.Oss.Tests/BucketApiTests.cs b/Autodesk.Forge.Oss.Tests/BucketApiTests.cs index b441ba7..775021d 100644 --- a/Autodesk.Forge.Oss.Tests/BucketApiTests.cs +++ b/Autodesk.Forge.Oss.Tests/BucketApiTests.cs @@ -40,7 +40,7 @@ public async Task BucketApi_CreateAndDelete() public async Task BucketApi_CreateAndDelete_Region(string region) { var bucketKey = $"{BucketKey}_{region}".ToLower(); - var bucketCreated = await OssClient.CreateBucketAsync(bucketKey, region: region); + var bucketCreated = await OssClient.CreateBucketAsync(bucketKey, region); Assert.AreEqual(bucketKey, bucketCreated.BucketKey); Assert.IsNotNull(await OssClient.GetBucketDetailsAsync(bucketKey)); diff --git a/Autodesk.Forge.Oss/OssClient.cs b/Autodesk.Forge.Oss/OssClient.cs index 03e5235..d87d39d 100644 --- a/Autodesk.Forge.Oss/OssClient.cs +++ b/Autodesk.Forge.Oss/OssClient.cs @@ -103,15 +103,15 @@ public async Task DeleteBucketAsync(string bucketKey) /// /// Thrown when fails to make API call /// Bucket key (required). - /// . - /// [Data retention policy](https://developer.autodesk.com/en/docs/data/v2/overview/retention-policy/) Acceptable values: `transient`, `temporary` or `persistent` (required). /// The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` (optional, default to US) + /// [Data retention policy](https://developer.autodesk.com/en/docs/data/v2/overview/retention-policy/) Acceptable values: `transient`, `temporary` or `persistent` (required). + /// . /// public async Task CreateBucketAsync( string bucketKey, - List allow = null, + string region = null, PostBucketsPayload.PolicyKeyEnum policyKey = PostBucketsPayload.PolicyKeyEnum.Transient, - string region = null) + List allow = null) { var postBuckets = new PostBucketsPayload(bucketKey, allow, policyKey); return await this.CreateBucketAsync(postBuckets, region); diff --git a/CHANGELOG.md b/CHANGELOG.md index 85f7ed2..e88f55b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Autodesk.Forge - Copy `BucketsApi`, `ObjectsApi`, `TwoLeggedApi` from the original `forge-api-dotnet-client` repository. - Update deprecated `x-ads-region` to `region` when creating a bucket. [buckets-POST](https://aps.autodesk.com/en/docs/data/v2/reference/http/buckets-POST/) +### Updated +- Update `CreateBucketAsync` to work with `region`. ### Tests - Add `BucketApi_CreateAndDelete_Region` From 5f225cd1c18f4d057deb336893424f96f3489d87 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Fri, 13 Dec 2024 15:24:36 -0300 Subject: [PATCH 06/10] Add Version --- Autodesk.Forge.Oss.sln | 1 + Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj | 1 - Autodesk.Forge/Autodesk.Forge.csproj | 1 - Directory.Build.props | 5 +++++ 4 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 Directory.Build.props diff --git a/Autodesk.Forge.Oss.sln b/Autodesk.Forge.Oss.sln index 914bf28..f27416c 100644 --- a/Autodesk.Forge.Oss.sln +++ b/Autodesk.Forge.Oss.sln @@ -10,6 +10,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution", "Solution", "{D62567F0-6FCF-4C5B-B139-B2B219D51FDF}" ProjectSection(SolutionItems) = preProject CHANGELOG.md = CHANGELOG.md + Directory.Build.props = Directory.Build.props LICENSE = LICENSE README.md = README.md EndProjectSection diff --git a/Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj b/Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj index ab668e2..30b1f94 100644 --- a/Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj +++ b/Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj @@ -55,7 +55,6 @@ ricaun.Autodesk.Forge.Oss - 3.0.0-alpha {54AC7247-0A9C-4A56-835B-D1790800647B} diff --git a/Autodesk.Forge/Autodesk.Forge.csproj b/Autodesk.Forge/Autodesk.Forge.csproj index 0f72444..a80b5aa 100644 --- a/Autodesk.Forge/Autodesk.Forge.csproj +++ b/Autodesk.Forge/Autodesk.Forge.csproj @@ -7,7 +7,6 @@ ricaun.Autodesk.Forge - 3.0.0 diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..67d578b --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,5 @@ + + + 3.0.0-alpha + + \ No newline at end of file From 6d9b3508df967586635390c723d05272a6a65176 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Fri, 13 Dec 2024 15:34:50 -0300 Subject: [PATCH 07/10] Add `snupkg` --- Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj b/Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj index 30b1f94..cdab2cd 100644 --- a/Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj +++ b/Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj @@ -85,6 +85,8 @@ $(OutputPath)\$(AssemblyName).xml + true + snupkg false From 880f763f865ca770c786c8f2f855535d2a162be2 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Fri, 13 Dec 2024 15:49:53 -0300 Subject: [PATCH 08/10] Add `DebugSymbols` --- Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj b/Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj index cdab2cd..3ba90ac 100644 --- a/Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj +++ b/Autodesk.Forge.Oss/Autodesk.Forge.Oss.csproj @@ -87,6 +87,8 @@ $(OutputPath)\$(AssemblyName).xml true snupkg + true + Full false From ec62571d480dd1669c307a5ecc4fb3cedd196203 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Wed, 18 Dec 2024 17:50:53 -0300 Subject: [PATCH 09/10] Version `3.0.0-rc` --- Directory.Build.props | 2 +- README.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 67d578b..84f7e5c 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,5 @@ - 3.0.0-alpha + 3.0.0-rc \ No newline at end of file diff --git a/README.md b/README.md index 81b9090..45afacc 100644 --- a/README.md +++ b/README.md @@ -22,10 +22,10 @@ ### Dependencies -- [Autodesk.Forge](https://github.com/Autodesk-Forge/forge-api-dotnet-client) assembly which provides services such as: - - Forge [TwoLeggedApi](https://github.com/Autodesk-Forge/forge-api-dotnet-client/blob/master/src/Autodesk.Forge/Api/TwoLeggedApi.cs) - - Data Management [BucketsApi](https://github.com/Autodesk-Forge/forge-api-dotnet-client/blob/master/src/Autodesk.Forge/Api/BucketsApi.cs) - - Data Management [ObjectsApi](https://github.com/Autodesk-Forge/forge-api-dotnet-client/blob/master/src/Autodesk.Forge/Api/ObjectsApi.cs) +- [Autodesk.Forge](Autodesk.Forge) assembly which provides services such as: + - Forge [TwoLeggedApi](Autodesk.Forge/Api/TwoLeggedApi.cs) + - Data Management [BucketsApi](Autodesk.Forge/Api/BucketsApi.cs) + - Data Management [ObjectsApi](Autodesk.Forge/Api/ObjectsApi.cs) ### Configuration From 13c49579b4c661d3000dd6f18f19caaa80eeddef Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Wed, 18 Dec 2024 17:55:31 -0300 Subject: [PATCH 10/10] Version 3.0.0 --- CHANGELOG.md | 2 +- Directory.Build.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e88f55b..448b347 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Create `Autodesk.Forge` internal project. ### Autodesk.Forge - Copy `BucketsApi`, `ObjectsApi`, `TwoLeggedApi` from the original `forge-api-dotnet-client` repository. -- Update deprecated `x-ads-region` to `region` when creating a bucket. [buckets-POST](https://aps.autodesk.com/en/docs/data/v2/reference/http/buckets-POST/) +- Update deprecated `x-ads-region` to `region` when creating a bucket. [buckets-POST](https://aps.autodesk.com/en/docs/data/v2/reference/http/buckets-POST/) (Fix: #10) ### Updated - Update `CreateBucketAsync` to work with `region`. ### Tests diff --git a/Directory.Build.props b/Directory.Build.props index 84f7e5c..1b2b479 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,5 @@ - 3.0.0-rc + 3.0.0 \ No newline at end of file