From e718f5a30946a7178c0562d5e66ec95d8795db7f Mon Sep 17 00:00:00 2001 From: bounav Date: Fri, 28 Mar 2025 12:03:08 +0000 Subject: [PATCH] Targeting .net standard, updated .csproj format and restsharp dependency - Using new simplified .csproj format + nuget package references - Targeting .net standard 2.0 - Updated RestSharp dependency and fixed breaking code changes --- DocRaptor.sln | 27 +- src/DocRaptor/Api/DocApi.cs | 362 +++++++++--------- src/DocRaptor/Client/ApiClient.cs | 51 ++- src/DocRaptor/Client/ApiResponse.cs | 6 +- src/DocRaptor/Client/Configuration.cs | 26 +- src/DocRaptor/Client/ExceptionFactory.cs | 2 +- src/DocRaptor/Client/GlobalConfiguration.cs | 12 +- src/DocRaptor/Client/IApiAccessor.cs | 4 - .../Client/IReadableConfiguration.cs | 2 +- src/DocRaptor/Client/SwaggerDateConverter.cs | 30 ++ src/DocRaptor/DocRaptor.csproj | 90 +---- src/DocRaptor/DocRaptor.nuspec | 42 -- src/DocRaptor/Model/AsyncDoc.cs | 9 +- src/DocRaptor/Model/Doc.cs | 42 +- src/DocRaptor/Model/DocStatus.cs | 13 +- src/DocRaptor/Model/PrinceOptions.cs | 179 +++------ src/DocRaptor/Properties/AssemblyInfo.cs | 32 -- src/DocRaptor/packages.config | 7 - 18 files changed, 370 insertions(+), 566 deletions(-) create mode 100644 src/DocRaptor/Client/SwaggerDateConverter.cs delete mode 100644 src/DocRaptor/DocRaptor.nuspec delete mode 100644 src/DocRaptor/Properties/AssemblyInfo.cs delete mode 100644 src/DocRaptor/packages.config diff --git a/DocRaptor.sln b/DocRaptor.sln index 97573bb..c778bbb 100644 --- a/DocRaptor.sln +++ b/DocRaptor.sln @@ -1,10 +1,8 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -VisualStudioVersion = 12.0.0.0 -MinimumVisualStudioVersion = 10.0.0.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DocRaptor", "src\DocRaptor\DocRaptor.csproj", "{CFD94733-F020-45EE-B121-AA0CA516F4FD}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DocRaptor.Test", "src\DocRaptor.Test\DocRaptor.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32922.545 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocRaptor", "src\DocRaptor\DocRaptor.csproj", "{0A8810C0-4EB7-4154-9987-2E4EAA55C9A7}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -12,16 +10,15 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CFD94733-F020-45EE-B121-AA0CA516F4FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CFD94733-F020-45EE-B121-AA0CA516F4FD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CFD94733-F020-45EE-B121-AA0CA516F4FD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CFD94733-F020-45EE-B121-AA0CA516F4FD}.Release|Any CPU.Build.0 = Release|Any CPU - {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU - {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU - {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU + {0A8810C0-4EB7-4154-9987-2E4EAA55C9A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0A8810C0-4EB7-4154-9987-2E4EAA55C9A7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0A8810C0-4EB7-4154-9987-2E4EAA55C9A7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0A8810C0-4EB7-4154-9987-2E4EAA55C9A7}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection -EndGlobal \ No newline at end of file + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {65B918BC-E1D7-41E9-840E-3C41F712F4F1} + EndGlobalSection +EndGlobal diff --git a/src/DocRaptor/Api/DocApi.cs b/src/DocRaptor/Api/DocApi.cs index 5aa7af4..0318535 100644 --- a/src/DocRaptor/Api/DocApi.cs +++ b/src/DocRaptor/Api/DocApi.cs @@ -12,7 +12,6 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; -using System.Threading; using RestSharp; using DocRaptor.Client; using DocRaptor.Model; @@ -32,7 +31,7 @@ public interface IDocApi : IApiAccessor /// Creates a document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document. /// /// Thrown when fails to make API call - /// + /// The document to be created. /// AsyncDoc AsyncDoc CreateAsyncDoc (Doc doc); @@ -43,7 +42,7 @@ public interface IDocApi : IApiAccessor /// Creates a document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document. /// /// Thrown when fails to make API call - /// + /// The document to be created. /// ApiResponse of AsyncDoc ApiResponse CreateAsyncDocWithHttpInfo (Doc doc); /// @@ -53,7 +52,7 @@ public interface IDocApi : IApiAccessor /// Creates a document synchronously. /// /// Thrown when fails to make API call - /// + /// The document to be created. /// byte[] byte[] CreateDoc (Doc doc); @@ -64,7 +63,7 @@ public interface IDocApi : IApiAccessor /// Creates a document synchronously. /// /// Thrown when fails to make API call - /// + /// The document to be created. /// ApiResponse of byte[] ApiResponse CreateDocWithHttpInfo (Doc doc); /// @@ -74,7 +73,7 @@ public interface IDocApi : IApiAccessor /// Creates a hosted document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document. /// /// Thrown when fails to make API call - /// + /// The document to be created. /// AsyncDoc AsyncDoc CreateHostedAsyncDoc (Doc doc); @@ -85,7 +84,7 @@ public interface IDocApi : IApiAccessor /// Creates a hosted document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document. /// /// Thrown when fails to make API call - /// + /// The document to be created. /// ApiResponse of AsyncDoc ApiResponse CreateHostedAsyncDocWithHttpInfo (Doc doc); /// @@ -181,10 +180,9 @@ public interface IDocApi : IApiAccessor /// Creates a document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document. /// /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel request (optional) + /// The document to be created. /// Task of AsyncDoc - System.Threading.Tasks.Task CreateAsyncDocAsync (Doc doc, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task CreateAsyncDocAsync (Doc doc); /// /// @@ -193,10 +191,9 @@ public interface IDocApi : IApiAccessor /// Creates a document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document. /// /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel request (optional) + /// The document to be created. /// Task of ApiResponse (AsyncDoc) - System.Threading.Tasks.Task> CreateAsyncDocWithHttpInfoAsync (Doc doc, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateAsyncDocAsyncWithHttpInfo (Doc doc); /// /// /// @@ -204,10 +201,9 @@ public interface IDocApi : IApiAccessor /// Creates a document synchronously. /// /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel request (optional) + /// The document to be created. /// Task of byte[] - System.Threading.Tasks.Task CreateDocAsync (Doc doc, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task CreateDocAsync (Doc doc); /// /// @@ -216,10 +212,9 @@ public interface IDocApi : IApiAccessor /// Creates a document synchronously. /// /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel request (optional) + /// The document to be created. /// Task of ApiResponse (byte[]) - System.Threading.Tasks.Task> CreateDocWithHttpInfoAsync (Doc doc, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateDocAsyncWithHttpInfo (Doc doc); /// /// /// @@ -227,10 +222,9 @@ public interface IDocApi : IApiAccessor /// Creates a hosted document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document. /// /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel request (optional) + /// The document to be created. /// Task of AsyncDoc - System.Threading.Tasks.Task CreateHostedAsyncDocAsync (Doc doc, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task CreateHostedAsyncDocAsync (Doc doc); /// /// @@ -239,10 +233,9 @@ public interface IDocApi : IApiAccessor /// Creates a hosted document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document. /// /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel request (optional) + /// The document to be created. /// Task of ApiResponse (AsyncDoc) - System.Threading.Tasks.Task> CreateHostedAsyncDocWithHttpInfoAsync (Doc doc, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateHostedAsyncDocAsyncWithHttpInfo (Doc doc); /// /// /// @@ -251,9 +244,8 @@ public interface IDocApi : IApiAccessor /// /// Thrown when fails to make API call /// The document to be created. - /// Cancellation Token to cancel request (optional) /// Task of DocStatus - System.Threading.Tasks.Task CreateHostedDocAsync (Doc doc, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task CreateHostedDocAsync (Doc doc); /// /// @@ -263,9 +255,8 @@ public interface IDocApi : IApiAccessor /// /// Thrown when fails to make API call /// The document to be created. - /// Cancellation Token to cancel request (optional) /// Task of ApiResponse (DocStatus) - System.Threading.Tasks.Task> CreateHostedDocWithHttpInfoAsync (Doc doc, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateHostedDocAsyncWithHttpInfo (Doc doc); /// /// /// @@ -274,9 +265,8 @@ public interface IDocApi : IApiAccessor /// /// Thrown when fails to make API call /// The download_id returned from status request or hosted document response. - /// Cancellation Token to cancel request (optional) /// Task of void - System.Threading.Tasks.Task ExpireAsync (string id, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task ExpireAsync (string id); /// /// @@ -286,9 +276,8 @@ public interface IDocApi : IApiAccessor /// /// Thrown when fails to make API call /// The download_id returned from status request or hosted document response. - /// Cancellation Token to cancel request (optional) /// Task of ApiResponse - System.Threading.Tasks.Task> ExpireWithHttpInfoAsync (string id, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> ExpireAsyncWithHttpInfo (string id); /// /// /// @@ -297,9 +286,8 @@ public interface IDocApi : IApiAccessor /// /// Thrown when fails to make API call /// The download_id returned from an async status request or callback. - /// Cancellation Token to cancel request (optional) /// Task of byte[] - System.Threading.Tasks.Task GetAsyncDocAsync (string id, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task GetAsyncDocAsync (string id); /// /// @@ -309,9 +297,8 @@ public interface IDocApi : IApiAccessor /// /// Thrown when fails to make API call /// The download_id returned from an async status request or callback. - /// Cancellation Token to cancel request (optional) /// Task of ApiResponse (byte[]) - System.Threading.Tasks.Task> GetAsyncDocWithHttpInfoAsync (string id, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetAsyncDocAsyncWithHttpInfo (string id); /// /// /// @@ -320,9 +307,8 @@ public interface IDocApi : IApiAccessor /// /// Thrown when fails to make API call /// The status_id returned when creating an asynchronous document. - /// Cancellation Token to cancel request (optional) /// Task of DocStatus - System.Threading.Tasks.Task GetAsyncDocStatusAsync (string id, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task GetAsyncDocStatusAsync (string id); /// /// @@ -332,9 +318,8 @@ public interface IDocApi : IApiAccessor /// /// Thrown when fails to make API call /// The status_id returned when creating an asynchronous document. - /// Cancellation Token to cancel request (optional) /// Task of ApiResponse (DocStatus) - System.Threading.Tasks.Task> GetAsyncDocStatusWithHttpInfoAsync (string id, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetAsyncDocStatusAsyncWithHttpInfo (string id); #endregion Asynchronous Operations } @@ -356,17 +341,6 @@ public DocApi(String basePath) ExceptionFactory = DocRaptor.Client.Configuration.DefaultExceptionFactory; } - /// - /// Initializes a new instance of the class - /// - /// - public DocApi() - { - this.Configuration = DocRaptor.Client.Configuration.Default; - - ExceptionFactory = DocRaptor.Client.Configuration.DefaultExceptionFactory; - } - /// /// Initializes a new instance of the class /// using Configuration object @@ -389,7 +363,7 @@ public DocApi(DocRaptor.Client.Configuration configuration = null) /// The base path public String GetBasePath() { - return this.Configuration.ApiClient.RestClient.BaseUrl.ToString(); + return this.Configuration.ApiClient.RestClient.Options.BaseUrl?.ToString(); } /// @@ -450,7 +424,7 @@ public void AddDefaultHeader(string key, string value) /// Creates a document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document. /// /// Thrown when fails to make API call - /// + /// The document to be created. /// AsyncDoc public AsyncDoc CreateAsyncDoc (Doc doc) { @@ -462,9 +436,9 @@ public AsyncDoc CreateAsyncDoc (Doc doc) /// Creates a document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document. /// /// Thrown when fails to make API call - /// + /// The document to be created. /// ApiResponse of AsyncDoc - public ApiResponse CreateAsyncDocWithHttpInfo (Doc doc) + public ApiResponse< AsyncDoc > CreateAsyncDocWithHttpInfo (Doc doc) { // verify the required parameter 'doc' is set if (doc == null) @@ -480,13 +454,16 @@ public ApiResponse CreateAsyncDocWithHttpInfo (Doc doc) // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { - "application/json" }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "*/*" + "application/json", + "application/xml", + "application/pdf", + "application/vnd.ms-excel", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -509,8 +486,8 @@ public ApiResponse CreateAsyncDocWithHttpInfo (Doc doc) } // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + RestResponse localVarResponse = (RestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int) localVarResponse.StatusCode; @@ -522,7 +499,7 @@ public ApiResponse CreateAsyncDocWithHttpInfo (Doc doc) } return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + localVarResponse.Headers, (AsyncDoc) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(AsyncDoc))); } @@ -530,12 +507,11 @@ public ApiResponse CreateAsyncDocWithHttpInfo (Doc doc) /// Creates a document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document. /// /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel request (optional) + /// The document to be created. /// Task of AsyncDoc - public async System.Threading.Tasks.Task CreateAsyncDocAsync (Doc doc, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task CreateAsyncDocAsync (Doc doc) { - ApiResponse localVarResponse = await CreateAsyncDocWithHttpInfoAsync(doc, cancellationToken); + ApiResponse localVarResponse = await CreateAsyncDocAsyncWithHttpInfo(doc); return localVarResponse.Data; } @@ -544,10 +520,9 @@ public ApiResponse CreateAsyncDocWithHttpInfo (Doc doc) /// Creates a document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document. /// /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel request (optional) + /// The document to be created. /// Task of ApiResponse (AsyncDoc) - public async System.Threading.Tasks.Task> CreateAsyncDocWithHttpInfoAsync (Doc doc, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateAsyncDocAsyncWithHttpInfo (Doc doc) { // verify the required parameter 'doc' is set if (doc == null) @@ -563,13 +538,16 @@ public ApiResponse CreateAsyncDocWithHttpInfo (Doc doc) // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { - "application/json" }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "*/*" + "application/json", + "application/xml", + "application/pdf", + "application/vnd.ms-excel", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -592,9 +570,9 @@ public ApiResponse CreateAsyncDocWithHttpInfo (Doc doc) } // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType, cancellationToken); + RestResponse localVarResponse = (RestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int) localVarResponse.StatusCode; @@ -605,7 +583,7 @@ public ApiResponse CreateAsyncDocWithHttpInfo (Doc doc) } return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + localVarResponse.Headers, (AsyncDoc) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(AsyncDoc))); } @@ -613,7 +591,7 @@ public ApiResponse CreateAsyncDocWithHttpInfo (Doc doc) /// Creates a document synchronously. /// /// Thrown when fails to make API call - /// + /// The document to be created. /// byte[] public byte[] CreateDoc (Doc doc) { @@ -625,9 +603,9 @@ public byte[] CreateDoc (Doc doc) /// Creates a document synchronously. /// /// Thrown when fails to make API call - /// + /// The document to be created. /// ApiResponse of byte[] - public ApiResponse CreateDocWithHttpInfo (Doc doc) + public ApiResponse< byte[] > CreateDocWithHttpInfo (Doc doc) { // verify the required parameter 'doc' is set if (doc == null) @@ -643,13 +621,16 @@ public ApiResponse CreateDocWithHttpInfo (Doc doc) // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { - "application/json" }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "*/*" + "application/json", + "application/xml", + "application/pdf", + "application/vnd.ms-excel", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -672,8 +653,8 @@ public ApiResponse CreateDocWithHttpInfo (Doc doc) } // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + RestResponse localVarResponse = (RestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int) localVarResponse.StatusCode; @@ -683,9 +664,9 @@ public ApiResponse CreateDocWithHttpInfo (Doc doc) Exception exception = ExceptionFactory("CreateDoc", localVarResponse); if (exception != null) throw exception; } - + return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + localVarResponse.Headers, (byte[]) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(byte[]))); } @@ -693,12 +674,11 @@ public ApiResponse CreateDocWithHttpInfo (Doc doc) /// Creates a document synchronously. /// /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel request (optional) + /// The document to be created. /// Task of byte[] - public async System.Threading.Tasks.Task CreateDocAsync (Doc doc, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task CreateDocAsync (Doc doc) { - ApiResponse localVarResponse = await CreateDocWithHttpInfoAsync(doc, cancellationToken); + ApiResponse localVarResponse = await CreateDocAsyncWithHttpInfo(doc); return localVarResponse.Data; } @@ -707,10 +687,9 @@ public ApiResponse CreateDocWithHttpInfo (Doc doc) /// Creates a document synchronously. /// /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel request (optional) + /// The document to be created. /// Task of ApiResponse (byte[]) - public async System.Threading.Tasks.Task> CreateDocWithHttpInfoAsync (Doc doc, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateDocAsyncWithHttpInfo (Doc doc) { // verify the required parameter 'doc' is set if (doc == null) @@ -726,13 +705,16 @@ public ApiResponse CreateDocWithHttpInfo (Doc doc) // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { - "application/json" }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "*/*" + "application/json", + "application/xml", + "application/pdf", + "application/vnd.ms-excel", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -755,9 +737,9 @@ public ApiResponse CreateDocWithHttpInfo (Doc doc) } // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType, cancellationToken); + RestResponse localVarResponse = (RestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int) localVarResponse.StatusCode; @@ -768,7 +750,7 @@ public ApiResponse CreateDocWithHttpInfo (Doc doc) } return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + localVarResponse.Headers, (byte[]) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(byte[]))); } @@ -776,7 +758,7 @@ public ApiResponse CreateDocWithHttpInfo (Doc doc) /// Creates a hosted document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document. /// /// Thrown when fails to make API call - /// + /// The document to be created. /// AsyncDoc public AsyncDoc CreateHostedAsyncDoc (Doc doc) { @@ -788,9 +770,9 @@ public AsyncDoc CreateHostedAsyncDoc (Doc doc) /// Creates a hosted document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document. /// /// Thrown when fails to make API call - /// + /// The document to be created. /// ApiResponse of AsyncDoc - public ApiResponse CreateHostedAsyncDocWithHttpInfo (Doc doc) + public ApiResponse< AsyncDoc > CreateHostedAsyncDocWithHttpInfo (Doc doc) { // verify the required parameter 'doc' is set if (doc == null) @@ -806,13 +788,16 @@ public ApiResponse CreateHostedAsyncDocWithHttpInfo (Doc doc) // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { - "application/json" }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "*/*" + "application/json", + "application/xml", + "application/pdf", + "application/vnd.ms-excel", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -835,8 +820,8 @@ public ApiResponse CreateHostedAsyncDocWithHttpInfo (Doc doc) } // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + RestResponse localVarResponse = (RestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int) localVarResponse.StatusCode; @@ -848,7 +833,7 @@ public ApiResponse CreateHostedAsyncDocWithHttpInfo (Doc doc) } return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + localVarResponse.Headers, (AsyncDoc) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(AsyncDoc))); } @@ -856,12 +841,11 @@ public ApiResponse CreateHostedAsyncDocWithHttpInfo (Doc doc) /// Creates a hosted document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document. /// /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel request (optional) + /// The document to be created. /// Task of AsyncDoc - public async System.Threading.Tasks.Task CreateHostedAsyncDocAsync (Doc doc, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task CreateHostedAsyncDocAsync (Doc doc) { - ApiResponse localVarResponse = await CreateHostedAsyncDocWithHttpInfoAsync(doc, cancellationToken); + ApiResponse localVarResponse = await CreateHostedAsyncDocAsyncWithHttpInfo(doc); return localVarResponse.Data; } @@ -870,10 +854,9 @@ public ApiResponse CreateHostedAsyncDocWithHttpInfo (Doc doc) /// Creates a hosted document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document. /// /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel request (optional) + /// The document to be created. /// Task of ApiResponse (AsyncDoc) - public async System.Threading.Tasks.Task> CreateHostedAsyncDocWithHttpInfoAsync (Doc doc, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateHostedAsyncDocAsyncWithHttpInfo (Doc doc) { // verify the required parameter 'doc' is set if (doc == null) @@ -889,13 +872,16 @@ public ApiResponse CreateHostedAsyncDocWithHttpInfo (Doc doc) // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { - "application/json" }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "*/*" + "application/json", + "application/xml", + "application/pdf", + "application/vnd.ms-excel", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -918,9 +904,9 @@ public ApiResponse CreateHostedAsyncDocWithHttpInfo (Doc doc) } // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType, cancellationToken); + RestResponse localVarResponse = (RestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int) localVarResponse.StatusCode; @@ -931,7 +917,7 @@ public ApiResponse CreateHostedAsyncDocWithHttpInfo (Doc doc) } return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + localVarResponse.Headers, (AsyncDoc) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(AsyncDoc))); } @@ -953,7 +939,7 @@ public DocStatus CreateHostedDoc (Doc doc) /// Thrown when fails to make API call /// The document to be created. /// ApiResponse of DocStatus - public ApiResponse CreateHostedDocWithHttpInfo (Doc doc) + public ApiResponse< DocStatus > CreateHostedDocWithHttpInfo (Doc doc) { // verify the required parameter 'doc' is set if (doc == null) @@ -969,13 +955,16 @@ public ApiResponse CreateHostedDocWithHttpInfo (Doc doc) // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { - "application/json" }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "*/*" + "application/json", + "application/xml", + "application/pdf", + "application/vnd.ms-excel", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -998,8 +987,8 @@ public ApiResponse CreateHostedDocWithHttpInfo (Doc doc) } // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + RestResponse localVarResponse = (RestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int) localVarResponse.StatusCode; @@ -1011,7 +1000,7 @@ public ApiResponse CreateHostedDocWithHttpInfo (Doc doc) } return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + localVarResponse.Headers, (DocStatus) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(DocStatus))); } @@ -1020,11 +1009,10 @@ public ApiResponse CreateHostedDocWithHttpInfo (Doc doc) /// /// Thrown when fails to make API call /// The document to be created. - /// Cancellation Token to cancel request (optional) /// Task of DocStatus - public async System.Threading.Tasks.Task CreateHostedDocAsync (Doc doc, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task CreateHostedDocAsync (Doc doc) { - ApiResponse localVarResponse = await CreateHostedDocWithHttpInfoAsync(doc, cancellationToken); + ApiResponse localVarResponse = await CreateHostedDocAsyncWithHttpInfo(doc); return localVarResponse.Data; } @@ -1034,9 +1022,8 @@ public ApiResponse CreateHostedDocWithHttpInfo (Doc doc) /// /// Thrown when fails to make API call /// The document to be created. - /// Cancellation Token to cancel request (optional) /// Task of ApiResponse (DocStatus) - public async System.Threading.Tasks.Task> CreateHostedDocWithHttpInfoAsync (Doc doc, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateHostedDocAsyncWithHttpInfo (Doc doc) { // verify the required parameter 'doc' is set if (doc == null) @@ -1052,13 +1039,16 @@ public ApiResponse CreateHostedDocWithHttpInfo (Doc doc) // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { - "application/json" }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "*/*" + "application/json", + "application/xml", + "application/pdf", + "application/vnd.ms-excel", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1081,9 +1071,9 @@ public ApiResponse CreateHostedDocWithHttpInfo (Doc doc) } // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType, cancellationToken); + RestResponse localVarResponse = (RestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int) localVarResponse.StatusCode; @@ -1094,7 +1084,7 @@ public ApiResponse CreateHostedDocWithHttpInfo (Doc doc) } return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + localVarResponse.Headers, (DocStatus) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(DocStatus))); } @@ -1136,6 +1126,11 @@ public ApiResponse ExpireWithHttpInfo (string id) // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { + "application/json", + "application/xml", + "application/pdf", + "application/vnd.ms-excel", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1151,8 +1146,8 @@ public ApiResponse ExpireWithHttpInfo (string id) } // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, - Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + RestResponse localVarResponse = (RestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.Patch, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int) localVarResponse.StatusCode; @@ -1164,7 +1159,7 @@ public ApiResponse ExpireWithHttpInfo (string id) } return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + localVarResponse.Headers, null); } @@ -1173,11 +1168,10 @@ public ApiResponse ExpireWithHttpInfo (string id) /// /// Thrown when fails to make API call /// The download_id returned from status request or hosted document response. - /// Cancellation Token to cancel request (optional) /// Task of void - public async System.Threading.Tasks.Task ExpireAsync (string id, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task ExpireAsync (string id) { - await ExpireWithHttpInfoAsync(id, cancellationToken); + await ExpireAsyncWithHttpInfo(id); } @@ -1186,9 +1180,8 @@ public ApiResponse ExpireWithHttpInfo (string id) /// /// Thrown when fails to make API call /// The download_id returned from status request or hosted document response. - /// Cancellation Token to cancel request (optional) /// Task of ApiResponse - public async System.Threading.Tasks.Task> ExpireWithHttpInfoAsync (string id, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> ExpireAsyncWithHttpInfo (string id) { // verify the required parameter 'id' is set if (id == null) @@ -1209,6 +1202,11 @@ public ApiResponse ExpireWithHttpInfo (string id) // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { + "application/json", + "application/xml", + "application/pdf", + "application/vnd.ms-excel", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1224,9 +1222,9 @@ public ApiResponse ExpireWithHttpInfo (string id) } // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, - Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType, cancellationToken); + RestResponse localVarResponse = (RestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Patch, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int) localVarResponse.StatusCode; @@ -1237,7 +1235,7 @@ public ApiResponse ExpireWithHttpInfo (string id) } return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + localVarResponse.Headers, null); } @@ -1259,7 +1257,7 @@ public byte[] GetAsyncDoc (string id) /// Thrown when fails to make API call /// The download_id returned from an async status request or callback. /// ApiResponse of byte[] - public ApiResponse GetAsyncDocWithHttpInfo (string id) + public ApiResponse< byte[] > GetAsyncDocWithHttpInfo (string id) { // verify the required parameter 'id' is set if (id == null) @@ -1280,7 +1278,11 @@ public ApiResponse GetAsyncDocWithHttpInfo (string id) // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "*/*" + "application/json", + "application/xml", + "application/pdf", + "application/vnd.ms-excel", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1296,8 +1298,8 @@ public ApiResponse GetAsyncDocWithHttpInfo (string id) } // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + RestResponse localVarResponse = (RestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int) localVarResponse.StatusCode; @@ -1309,7 +1311,7 @@ public ApiResponse GetAsyncDocWithHttpInfo (string id) } return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + localVarResponse.Headers, (byte[]) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(byte[]))); } @@ -1318,11 +1320,10 @@ public ApiResponse GetAsyncDocWithHttpInfo (string id) /// /// Thrown when fails to make API call /// The download_id returned from an async status request or callback. - /// Cancellation Token to cancel request (optional) /// Task of byte[] - public async System.Threading.Tasks.Task GetAsyncDocAsync (string id, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task GetAsyncDocAsync (string id) { - ApiResponse localVarResponse = await GetAsyncDocWithHttpInfoAsync(id, cancellationToken); + ApiResponse localVarResponse = await GetAsyncDocAsyncWithHttpInfo(id); return localVarResponse.Data; } @@ -1332,9 +1333,8 @@ public ApiResponse GetAsyncDocWithHttpInfo (string id) /// /// Thrown when fails to make API call /// The download_id returned from an async status request or callback. - /// Cancellation Token to cancel request (optional) /// Task of ApiResponse (byte[]) - public async System.Threading.Tasks.Task> GetAsyncDocWithHttpInfoAsync (string id, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetAsyncDocAsyncWithHttpInfo (string id) { // verify the required parameter 'id' is set if (id == null) @@ -1355,7 +1355,11 @@ public ApiResponse GetAsyncDocWithHttpInfo (string id) // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "*/*" + "application/json", + "application/xml", + "application/pdf", + "application/vnd.ms-excel", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1371,9 +1375,9 @@ public ApiResponse GetAsyncDocWithHttpInfo (string id) } // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType, cancellationToken); + RestResponse localVarResponse = (RestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int) localVarResponse.StatusCode; @@ -1384,7 +1388,7 @@ public ApiResponse GetAsyncDocWithHttpInfo (string id) } return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + localVarResponse.Headers, (byte[]) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(byte[]))); } @@ -1406,7 +1410,7 @@ public DocStatus GetAsyncDocStatus (string id) /// Thrown when fails to make API call /// The status_id returned when creating an asynchronous document. /// ApiResponse of DocStatus - public ApiResponse GetAsyncDocStatusWithHttpInfo (string id) + public ApiResponse< DocStatus > GetAsyncDocStatusWithHttpInfo (string id) { // verify the required parameter 'id' is set if (id == null) @@ -1427,7 +1431,11 @@ public ApiResponse GetAsyncDocStatusWithHttpInfo (string id) // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "*/*" + "application/json", + "application/xml", + "application/pdf", + "application/vnd.ms-excel", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1443,8 +1451,8 @@ public ApiResponse GetAsyncDocStatusWithHttpInfo (string id) } // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + RestResponse localVarResponse = (RestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int) localVarResponse.StatusCode; @@ -1456,7 +1464,7 @@ public ApiResponse GetAsyncDocStatusWithHttpInfo (string id) } return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + localVarResponse.Headers, (DocStatus) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(DocStatus))); } @@ -1465,11 +1473,10 @@ public ApiResponse GetAsyncDocStatusWithHttpInfo (string id) /// /// Thrown when fails to make API call /// The status_id returned when creating an asynchronous document. - /// Cancellation Token to cancel request (optional) /// Task of DocStatus - public async System.Threading.Tasks.Task GetAsyncDocStatusAsync (string id, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task GetAsyncDocStatusAsync (string id) { - ApiResponse localVarResponse = await GetAsyncDocStatusWithHttpInfoAsync(id, cancellationToken); + ApiResponse localVarResponse = await GetAsyncDocStatusAsyncWithHttpInfo(id); return localVarResponse.Data; } @@ -1479,9 +1486,8 @@ public ApiResponse GetAsyncDocStatusWithHttpInfo (string id) /// /// Thrown when fails to make API call /// The status_id returned when creating an asynchronous document. - /// Cancellation Token to cancel request (optional) /// Task of ApiResponse (DocStatus) - public async System.Threading.Tasks.Task> GetAsyncDocStatusWithHttpInfoAsync (string id, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetAsyncDocStatusAsyncWithHttpInfo (string id) { // verify the required parameter 'id' is set if (id == null) @@ -1502,7 +1508,11 @@ public ApiResponse GetAsyncDocStatusWithHttpInfo (string id) // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "*/*" + "application/json", + "application/xml", + "application/pdf", + "application/vnd.ms-excel", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1518,9 +1528,9 @@ public ApiResponse GetAsyncDocStatusWithHttpInfo (string id) } // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType, cancellationToken); + RestResponse localVarResponse = (RestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int) localVarResponse.StatusCode; @@ -1531,7 +1541,7 @@ public ApiResponse GetAsyncDocStatusWithHttpInfo (string id) } return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), + localVarResponse.Headers, (DocStatus) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(DocStatus))); } diff --git a/src/DocRaptor/Client/ApiClient.cs b/src/DocRaptor/Client/ApiClient.cs index 82f4f53..606e1fc 100644 --- a/src/DocRaptor/Client/ApiClient.cs +++ b/src/DocRaptor/Client/ApiClient.cs @@ -11,13 +11,9 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Globalization; using System.Text.RegularExpressions; using System.IO; -using System.Threading; -using System.Web; using System.Linq; -using System.Net; using System.Text; using Newtonsoft.Json; using RestSharp; @@ -29,7 +25,7 @@ namespace DocRaptor.Client /// public partial class ApiClient { - public JsonSerializerSettings serializerSettings = new JsonSerializerSettings + private JsonSerializerSettings serializerSettings = new JsonSerializerSettings { ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor }; @@ -38,35 +34,43 @@ public partial class ApiClient /// Allows for extending request processing for generated code. /// /// The RestSharp request object - partial void InterceptRequest(IRestRequest request); + partial void InterceptRequest(RestRequest request); /// /// Allows for extending response processing for generated code. /// /// The RestSharp request object /// The RestSharp response object - partial void InterceptResponse(IRestRequest request, IRestResponse response); + partial void InterceptResponse(RestRequest request, RestResponse response); /// /// Initializes a new instance of the class /// with default configuration. /// - public ApiClient() + public ApiClient() : this(DocRaptor.Client.Configuration.Default) { - Configuration = DocRaptor.Client.Configuration.Default; - RestClient = new RestClient("https://api.docraptor.com"); } /// /// Initializes a new instance of the class - /// with default base path (https://api.docraptor.com). + /// with default base path (https://docraptor.com). /// /// An instance of Configuration. public ApiClient(Configuration config) { Configuration = config ?? DocRaptor.Client.Configuration.Default; - RestClient = new RestClient(Configuration.BasePath); + if (string.IsNullOrEmpty(Configuration.BasePath)) + { + DocRaptor.Client.Configuration.Default.BasePath = "https://docraptor.com"; + } + + RestClient = new RestClient(new RestClientOptions + { + BaseUrl = new Uri(Configuration.BasePath), + Timeout = TimeSpan.FromMilliseconds(Configuration.Timeout), + UserAgent = Configuration.UserAgent + }); } /// @@ -74,7 +78,7 @@ public ApiClient(Configuration config) /// with default configuration. /// /// The base path. - public ApiClient(String basePath = "https://api.docraptor.com") + public ApiClient(String basePath = "https://docraptor.com") { if (String.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty"); @@ -135,7 +139,7 @@ private RestRequest PrepareRequest( // add file parameter, if any foreach(var param in fileParams) { - request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentType); + request.AddFile(param.Value.Name, param.Value.GetFile, param.Value.FileName, param.Value.ContentType); } if (postBody != null) // http body (model or byte[]) parameter @@ -169,12 +173,6 @@ public Object CallApi( path, method, queryParams, postBody, headerParams, formParams, fileParams, pathParams, contentType); - // set timeout - - RestClient.Timeout = Configuration.Timeout; - // set user agent - RestClient.UserAgent = Configuration.UserAgent; - InterceptRequest(request); var response = RestClient.Execute(request); InterceptResponse(request, response); @@ -193,20 +191,18 @@ public Object CallApi( /// File parameters. /// Path parameters. /// Content type. - /// Cancellation Token. /// The Task instance. public async System.Threading.Tasks.Task CallApiAsync( String path, RestSharp.Method method, List> queryParams, Object postBody, Dictionary headerParams, Dictionary formParams, Dictionary fileParams, Dictionary pathParams, - String contentType, CancellationToken cancellationToken) + String contentType) { var request = PrepareRequest( path, method, queryParams, postBody, headerParams, formParams, fileParams, pathParams, contentType); - RestClient.UserAgent = Configuration.UserAgent; InterceptRequest(request); - var response = await RestClient.ExecuteTaskAsync(request, cancellationToken); + var response = await RestClient.ExecuteAsync(request); InterceptResponse(request, response); return (Object)response; } @@ -256,8 +252,6 @@ public string ParameterToString(object obj) // 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 bool) - return (bool)obj ? "true" : "false"; else if (obj is IList) { var flattenedString = new StringBuilder(); @@ -279,9 +273,9 @@ public string ParameterToString(object obj) /// The HTTP response. /// Object type. /// Object representation of the JSON string. - public object Deserialize(IRestResponse response, Type type) + public object Deserialize(RestResponse response, Type type) { - IList headers = response.Headers; + var headers = response.Headers; if (type == typeof(byte[])) // return byte array { return response.RawBytes; @@ -502,7 +496,6 @@ public static string SanitizeFilename(string filename) /// Convert params to key/value pairs. /// Use collectionFormat to properly format lists and collections. /// - /// Collection format. /// Key name. /// Value object. /// A list of KeyValuePairs diff --git a/src/DocRaptor/Client/ApiResponse.cs b/src/DocRaptor/Client/ApiResponse.cs index 916583a..21cfdf5 100644 --- a/src/DocRaptor/Client/ApiResponse.cs +++ b/src/DocRaptor/Client/ApiResponse.cs @@ -8,8 +8,8 @@ * Generated by: https://github.com/openapitools/openapi-generator.git */ -using System; using System.Collections.Generic; +using RestSharp; namespace DocRaptor.Client { @@ -28,7 +28,7 @@ public class ApiResponse /// Gets or sets the HTTP headers /// /// HTTP headers - public IDictionary Headers { get; private set; } + public IReadOnlyCollection Headers { get; private set; } /// /// Gets or sets the data (parsed HTTP body) @@ -42,7 +42,7 @@ public class ApiResponse /// HTTP status code. /// HTTP headers. /// Data (parsed HTTP body) - public ApiResponse(int statusCode, IDictionary headers, T data) + public ApiResponse(int statusCode, IReadOnlyCollection headers, T data) { this.StatusCode= statusCode; this.Headers = headers; diff --git a/src/DocRaptor/Client/Configuration.cs b/src/DocRaptor/Client/Configuration.cs index b6f909b..80fcbb8 100644 --- a/src/DocRaptor/Client/Configuration.cs +++ b/src/DocRaptor/Client/Configuration.cs @@ -9,12 +9,9 @@ */ using System; -using System.Reflection; using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Text; namespace DocRaptor.Client { @@ -29,7 +26,7 @@ public class Configuration : IReadableConfiguration /// Version of the package. /// /// Version of the package. - public const string Version = "4.0.0"; + public const string Version = "2.0.0"; /// /// Identifier for ISO 8601 DateTime Format @@ -114,8 +111,8 @@ static Configuration() /// public Configuration() { - UserAgent = "OpenAPI-Generator/4.0.0/csharp"; - BasePath = "https://api.docraptor.com"; + UserAgent = "Swagger-Codegen/2.0.0/csharp"; + BasePath = "https://docraptor.com"; DefaultHeader = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); ApiKeyPrefix = new ConcurrentDictionary(); @@ -131,7 +128,7 @@ public Configuration( IDictionary defaultHeader, IDictionary apiKey, IDictionary apiKeyPrefix, - string basePath = "https://api.docraptor.com") : this() + string basePath = "https://docraptor.com") : this() { if (string.IsNullOrWhiteSpace(basePath)) throw new ArgumentException("The provided basePath is invalid.", "basePath"); @@ -187,7 +184,7 @@ public Configuration( string tempFolderPath = null, string dateTimeFormat = null, int timeout = 100000, - string userAgent = "OpenAPI-Generator/4.0.0/csharp" + string userAgent = "Swagger-Codegen/2.0.0/csharp" // ReSharper restore UnusedParameter.Local ) { @@ -231,10 +228,6 @@ public virtual string BasePath { get { return _basePath; } set { _basePath = value; - // pass-through to ApiClient if it's set. - if(_apiClient != null) { - _apiClient.RestClient.BaseUrl = new Uri(_basePath); - } } } @@ -246,11 +239,11 @@ public virtual string BasePath { /// /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. /// + private int _timeout = 30000; public virtual int Timeout { - - get { return ApiClient.RestClient.Timeout; } - set { ApiClient.RestClient.Timeout = value; } + get { return _timeout; } + set { _timeout = value; } } /// @@ -305,6 +298,7 @@ public virtual string TempFolderPath { if (string.IsNullOrEmpty(value)) { + // Possible breaking change since swagger-codegen 2.2.1, enforce a valid temporary path on set. _tempFolderPath = Path.GetTempPath(); return; } @@ -421,7 +415,7 @@ public static String ToDebugReport() report += " OS: " + System.Environment.OSVersion + "\n"; report += " .NET Framework Version: " + System.Environment.Version + "\n"; report += " Version of the API: 2.0.0\n"; - report += " SDK Package Version: 4.0.0\n"; + report += " SDK Package Version: 2.0.0\n"; return report; } diff --git a/src/DocRaptor/Client/ExceptionFactory.cs b/src/DocRaptor/Client/ExceptionFactory.cs index febb46c..9bad439 100644 --- a/src/DocRaptor/Client/ExceptionFactory.cs +++ b/src/DocRaptor/Client/ExceptionFactory.cs @@ -20,5 +20,5 @@ namespace DocRaptor.Client /// Method name /// Response /// Exceptions - public delegate Exception ExceptionFactory(string methodName, IRestResponse response); + public delegate Exception ExceptionFactory(string methodName, RestResponse response); } diff --git a/src/DocRaptor/Client/GlobalConfiguration.cs b/src/DocRaptor/Client/GlobalConfiguration.cs index 21f12d7..af4a8ff 100644 --- a/src/DocRaptor/Client/GlobalConfiguration.cs +++ b/src/DocRaptor/Client/GlobalConfiguration.cs @@ -9,14 +9,6 @@ */ -using System; -using System.Reflection; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading; - namespace DocRaptor.Client { /// @@ -25,10 +17,10 @@ namespace DocRaptor.Client /// /// /// A customized implementation via partial class may reside in another file and may - /// be excluded from automatic generation via a .openapi-generator-ignore file. + /// be excluded from automatic generation via a .swagger-codegen-ignore file. /// public partial class GlobalConfiguration : Configuration { } -} \ No newline at end of file +} diff --git a/src/DocRaptor/Client/IApiAccessor.cs b/src/DocRaptor/Client/IApiAccessor.cs index 37f706c..e166265 100644 --- a/src/DocRaptor/Client/IApiAccessor.cs +++ b/src/DocRaptor/Client/IApiAccessor.cs @@ -10,10 +10,6 @@ using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using RestSharp; namespace DocRaptor.Client { diff --git a/src/DocRaptor/Client/IReadableConfiguration.cs b/src/DocRaptor/Client/IReadableConfiguration.cs index 1dbd800..7b1bcfb 100644 --- a/src/DocRaptor/Client/IReadableConfiguration.cs +++ b/src/DocRaptor/Client/IReadableConfiguration.cs @@ -45,7 +45,7 @@ public interface IReadableConfiguration /// /// Gets the date time format. /// - /// Date time format. + /// Date time foramt. string DateTimeFormat { get; } /// diff --git a/src/DocRaptor/Client/SwaggerDateConverter.cs b/src/DocRaptor/Client/SwaggerDateConverter.cs new file mode 100644 index 0000000..3a4a144 --- /dev/null +++ b/src/DocRaptor/Client/SwaggerDateConverter.cs @@ -0,0 +1,30 @@ +/* + * DocRaptor + * + * A native client library for the DocRaptor HTML to PDF/XLS service. + * + * OpenAPI spec version: 2.0.0 + * + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +using Newtonsoft.Json.Converters; + +namespace DocRaptor.Client +{ + /// + /// Formatter for 'date' swagger formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types + /// + public class SwaggerDateConverter : IsoDateTimeConverter + { + /// + /// Initializes a new instance of the class. + /// + public SwaggerDateConverter() + { + // full-date = date-fullyear "-" date-month "-" date-mday + DateTimeFormat = "yyyy-MM-dd"; + } + } +} diff --git a/src/DocRaptor/DocRaptor.csproj b/src/DocRaptor/DocRaptor.csproj index bca9619..359e6ec 100644 --- a/src/DocRaptor/DocRaptor.csproj +++ b/src/DocRaptor/DocRaptor.csproj @@ -1,79 +1,27 @@ - - - + - - Debug - AnyCPU - {CFD94733-F020-45EE-B121-AA0CA516F4FD} Library - Properties - DocRaptor - DocRaptor - v4.5 - 512 + netstandard2.0 + $author$ + $author$ + A .net client library for DocRaptor generated from a Swagger doc + https://docraptor.com/tos - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - bin\Debug\DocRaptor.xml - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - bin\Release\DocRaptor.xml - - - - - - - - - - - - - $(SolutionDir)\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll - ..\..\vendor\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll - - - $(SolutionDir)\packages\JsonSubTypes.1.6.0\lib\net45\JsonSubTypes.dll - ..\packages\JsonSubTypes.1.6.0\lib\net45\JsonSubTypes.dll - ..\..\packages\JsonSubTypes.1.6.0\lib\net45\JsonSubTypes.dll - ..\..\vendor\JsonSubTypes.1.6.0\lib\net45\JsonSubTypes.dll - - - $(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll - ..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll - ..\..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll - ..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll - - - + + + + + - + + True + \ + + + True + \ + - diff --git a/src/DocRaptor/DocRaptor.nuspec b/src/DocRaptor/DocRaptor.nuspec deleted file mode 100644 index f7512bc..0000000 --- a/src/DocRaptor/DocRaptor.nuspec +++ /dev/null @@ -1,42 +0,0 @@ - - - - - $id$ - OpenAPI Library - - - $version$ - - - $author$ - - - $author$ - false - false - - - A library generated from a OpenAPI doc - https://docraptor.com/tos - https://mit-license.org/ - - - - - - - - - - - - - - - - - - diff --git a/src/DocRaptor/Model/AsyncDoc.cs b/src/DocRaptor/Model/AsyncDoc.cs index fb25f6d..f1e5468 100644 --- a/src/DocRaptor/Model/AsyncDoc.cs +++ b/src/DocRaptor/Model/AsyncDoc.cs @@ -9,18 +9,11 @@ */ using System; -using System.Linq; -using System.IO; using System.Text; -using System.Text.RegularExpressions; -using System.Collections; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Runtime.Serialization; using Newtonsoft.Json; -using Newtonsoft.Json.Converters; using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = DocRaptor.Client.OpenAPIDateConverter; namespace DocRaptor.Model { @@ -65,7 +58,7 @@ public override string ToString() /// JSON string presentation of the object public virtual string ToJson() { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return JsonConvert.SerializeObject(this, Formatting.Indented); } /// diff --git a/src/DocRaptor/Model/Doc.cs b/src/DocRaptor/Model/Doc.cs index 0b8b9e5..6be3ab3 100644 --- a/src/DocRaptor/Model/Doc.cs +++ b/src/DocRaptor/Model/Doc.cs @@ -9,18 +9,13 @@ */ using System; -using System.Linq; using System.IO; using System.Text; -using System.Text.RegularExpressions; -using System.Collections; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = DocRaptor.Client.OpenAPIDateConverter; namespace DocRaptor.Model { @@ -54,14 +49,13 @@ public enum DocumentTypeEnum /// [EnumMember(Value = "xlsx")] Xlsx = 3 - } /// /// The type of document being created. /// /// The type of document being created. - [DataMember(Name="document_type", EmitDefaultValue=true)] + [DataMember(Name="document_type", EmitDefaultValue=false)] public DocumentTypeEnum DocumentType { get; set; } /// /// Force strict HTML validation. @@ -70,6 +64,7 @@ public enum DocumentTypeEnum [JsonConverter(typeof(StringEnumConverter))] public enum StrictEnum { + /// /// Enum None for value: none /// @@ -81,7 +76,6 @@ public enum StrictEnum /// [EnumMember(Value = "html")] Html = 2 - } /// @@ -100,7 +94,7 @@ protected Doc() { } /// /// A name for identifying your document. (required). /// The type of document being created. (required). - /// The HTML data to be transformed into a document. You must supply content using document_content or document_url. . + /// The HTML data to be transformed into a document. You must supply content using document_content or document_url. (required). /// The URL to fetch the HTML data to be transformed into a document. You must supply content using document_content or document_url. . /// Enable test mode for this document. Test documents are not charged for but include a watermark. (default to true). /// Specify a specific verison of the DocRaptor Pipeline to use.. @@ -115,7 +109,7 @@ protected Doc() { } /// The number of times a hosted document can be downloaded. If no limit is specified, the document will be available for an unlimited number of downloads.. /// The date and time at which a hosted document will be removed and no longer available. Must be a properly formatted ISO 8601 datetime, like 1981-01-23T08:02:30-05:00.. /// princeOptions. - public Doc(string name = default(string), DocumentTypeEnum documentType = default(DocumentTypeEnum), string documentContent = default(string), string documentUrl = default(string), bool test = true, string pipeline = default(string), StrictEnum? strict = default(StrictEnum?), bool ignoreResourceErrors = true, bool ignoreConsoleMessages = false, string tag = default(string), bool help = false, bool javascript = false, string referrer = default(string), string callbackUrl = default(string), int hostedDownloadLimit = default(int), string hostedExpiresAt = default(string), PrinceOptions princeOptions = default(PrinceOptions)) + public Doc(string name = default(string), DocumentTypeEnum documentType = default(DocumentTypeEnum), string documentContent = default(string), string documentUrl = default(string), bool? test = true, string pipeline = default(string), StrictEnum? strict = default(StrictEnum?), bool? ignoreResourceErrors = true, bool? ignoreConsoleMessages = false, string tag = default(string), bool? help = false, bool? javascript = false, string referrer = default(string), string callbackUrl = default(string), int? hostedDownloadLimit = default(int?), string hostedExpiresAt = default(string), PrinceOptions princeOptions = default(PrinceOptions)) { // to ensure "name" is required (not null) if (name == null) @@ -126,7 +120,6 @@ protected Doc() { } { this.Name = name; } - // to ensure "documentType" is required (not null) if (documentType == null) { @@ -136,8 +129,15 @@ protected Doc() { } { this.DocumentType = documentType; } - - this.DocumentContent = documentContent; + // to ensure "documentContent" is required (not null) + if (documentContent == null) + { + throw new InvalidDataException("documentContent is a required property for Doc and cannot be null"); + } + else + { + this.DocumentContent = documentContent; + } this.DocumentUrl = documentUrl; // use default value if no "test" provided if (test == null) @@ -198,7 +198,7 @@ protected Doc() { } /// A name for identifying your document. /// /// A name for identifying your document. - [DataMember(Name="name", EmitDefaultValue=true)] + [DataMember(Name="name", EmitDefaultValue=false)] public string Name { get; set; } @@ -221,7 +221,7 @@ protected Doc() { } /// /// Enable test mode for this document. Test documents are not charged for but include a watermark. [DataMember(Name="test", EmitDefaultValue=false)] - public bool Test { get; set; } + public bool? Test { get; set; } /// /// Specify a specific verison of the DocRaptor Pipeline to use. @@ -236,14 +236,14 @@ protected Doc() { } /// /// Failed loading of images/javascripts/stylesheets/etc. will not cause the rendering to stop. [DataMember(Name="ignore_resource_errors", EmitDefaultValue=false)] - public bool IgnoreResourceErrors { get; set; } + public bool? IgnoreResourceErrors { get; set; } /// /// Prevent console.log from stopping document rendering during JavaScript execution. /// /// Prevent console.log from stopping document rendering during JavaScript execution. [DataMember(Name="ignore_console_messages", EmitDefaultValue=false)] - public bool IgnoreConsoleMessages { get; set; } + public bool? IgnoreConsoleMessages { get; set; } /// /// A field for storing a small amount of metadata with this document. @@ -257,14 +257,14 @@ protected Doc() { } /// /// Request support help with this request if it succeeds. [DataMember(Name="help", EmitDefaultValue=false)] - public bool Help { get; set; } + public bool? Help { get; set; } /// /// Enable DocRaptor JavaScript parsing. PrinceXML JavaScript parsing is also available elsewhere. /// /// Enable DocRaptor JavaScript parsing. PrinceXML JavaScript parsing is also available elsewhere. [DataMember(Name="javascript", EmitDefaultValue=false)] - public bool Javascript { get; set; } + public bool? Javascript { get; set; } /// /// Set HTTP referrer when generating this document. @@ -285,7 +285,7 @@ protected Doc() { } /// /// The number of times a hosted document can be downloaded. If no limit is specified, the document will be available for an unlimited number of downloads. [DataMember(Name="hosted_download_limit", EmitDefaultValue=false)] - public int HostedDownloadLimit { get; set; } + public int? HostedDownloadLimit { get; set; } /// /// The date and time at which a hosted document will be removed and no longer available. Must be a properly formatted ISO 8601 datetime, like 1981-01-23T08:02:30-05:00. @@ -335,7 +335,7 @@ public override string ToString() /// JSON string presentation of the object public virtual string ToJson() { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return JsonConvert.SerializeObject(this, Formatting.Indented); } /// diff --git a/src/DocRaptor/Model/DocStatus.cs b/src/DocRaptor/Model/DocStatus.cs index 63b0bc2..20a90d0 100644 --- a/src/DocRaptor/Model/DocStatus.cs +++ b/src/DocRaptor/Model/DocStatus.cs @@ -9,18 +9,11 @@ */ using System; -using System.Linq; -using System.IO; using System.Text; -using System.Text.RegularExpressions; -using System.Collections; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Runtime.Serialization; using Newtonsoft.Json; -using Newtonsoft.Json.Converters; using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = DocRaptor.Client.OpenAPIDateConverter; namespace DocRaptor.Model { @@ -39,7 +32,7 @@ public partial class DocStatus : IEquatable, IValidatableObject /// Additional information.. /// Number of PDF pages in document.. /// Error information.. - public DocStatus(string status = default(string), string downloadUrl = default(string), string downloadId = default(string), string message = default(string), int numberOfPages = default(int), string validationErrors = default(string)) + public DocStatus(string status = default(string), string downloadUrl = default(string), string downloadId = default(string), string message = default(string), int? numberOfPages = default(int?), string validationErrors = default(string)) { this.Status = status; this.DownloadUrl = downloadUrl; @@ -82,7 +75,7 @@ public partial class DocStatus : IEquatable, IValidatableObject /// /// Number of PDF pages in document. [DataMember(Name="number_of_pages", EmitDefaultValue=false)] - public int NumberOfPages { get; set; } + public int? NumberOfPages { get; set; } /// /// Error information. @@ -115,7 +108,7 @@ public override string ToString() /// JSON string presentation of the object public virtual string ToJson() { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return JsonConvert.SerializeObject(this, Formatting.Indented); } /// diff --git a/src/DocRaptor/Model/PrinceOptions.cs b/src/DocRaptor/Model/PrinceOptions.cs index 029913e..934b399 100644 --- a/src/DocRaptor/Model/PrinceOptions.cs +++ b/src/DocRaptor/Model/PrinceOptions.cs @@ -9,18 +9,12 @@ */ using System; -using System.Linq; -using System.IO; using System.Text; -using System.Text.RegularExpressions; -using System.Collections; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = DocRaptor.Client.OpenAPIDateConverter; namespace DocRaptor.Model { @@ -31,36 +25,13 @@ namespace DocRaptor.Model public partial class PrinceOptions : IEquatable, IValidatableObject { /// - /// Set encryption key size. + /// Specify the input format. /// - /// Set encryption key size. - public enum KeyBitsEnum - { - /// - /// Enum NUMBER_40 for value: 40 - /// - NUMBER_40 = 40, - - /// - /// Enum NUMBER_128 for value: 128 - /// - NUMBER_128 = 128 - - } - - /// - /// Set encryption key size. - /// - /// Set encryption key size. - [DataMember(Name="key_bits", EmitDefaultValue=false)] - public KeyBitsEnum? KeyBits { get; set; } - /// - /// Specify the input format, defaults to html. - /// - /// Specify the input format, defaults to html. + /// Specify the input format. [JsonConverter(typeof(StringEnumConverter))] public enum InputEnum { + /// /// Enum Html for value: html /// @@ -78,13 +49,12 @@ public enum InputEnum /// [EnumMember(Value = "auto")] Auto = 3 - } /// - /// Specify the input format, defaults to html. + /// Specify the input format. /// - /// Specify the input format, defaults to html. + /// Specify the input format. [DataMember(Name="input", EmitDefaultValue=false)] public InputEnum? Input { get; set; } /// @@ -99,7 +69,7 @@ public enum InputEnum /// Set the HTTP proxy server.. /// Set the HTTP request timeout.. /// Disable SSL verification.. - /// Specify the CSS media type. Defaults to \"print\" but you may want to use \"screen\" for web styles.. + /// Specify the CSS media type. Defaults to \"print\" but you may want to use \"screen\" for web styles. (default to "print"). /// Ignore author stylesheets.. /// Ignore default stylesheets.. /// Disable font embedding in PDFs.. @@ -114,18 +84,14 @@ public enum InputEnum /// Disallow annotation of this PDF.. /// Disallow modification of this PDF.. /// Enable Prince debug mode.. - /// Specify the input format, defaults to html.. + /// Specify the input format. (default to InputEnum.Html). /// Deprecated, use the appropriate `pipeline` version. Specify a specific verison of PrinceXML to use.. /// Enable PrinceXML JavaScript. DocRaptor JavaScript parsing is also available elsewhere.. /// Set the DPI when rendering CSS. Defaults to 96 but can be set with Prince 9.0 and up.. /// In Prince 9.0 and up you can set the PDF profile.. /// Specify the PDF title, part of the document's metadata.. - /// Enable loading of iframes.. - /// Specify the page margin distance.. - /// Make form fields editable by default.. - public PrinceOptions(string baseurl = default(string), bool noXinclude = default(bool), bool noNetwork = default(bool), bool noParallelDownloads = default(bool), string httpUser = default(string), string httpPassword = default(string), string httpProxy = default(string), int httpTimeout = default(int), bool insecure = default(bool), string media = default(string), bool noAuthorStyle = default(bool), bool noDefaultStyle = default(bool), bool noEmbedFonts = default(bool), bool noSubsetFonts = default(bool), bool noCompress = default(bool), bool encrypt = default(bool), KeyBitsEnum? keyBits = default(KeyBitsEnum?), string userPassword = default(string), string ownerPassword = default(string), bool disallowPrint = default(bool), bool disallowCopy = default(bool), bool disallowAnnotate = default(bool), bool disallowModify = default(bool), bool debug = default(bool), InputEnum? input = default(InputEnum?), string version = default(string), bool javascript = default(bool), int cssDpi = default(int), string profile = default(string), string pdfTitle = default(string), bool? iframes = default(bool?), string pageMargin = default(string), bool pdfForms = default(bool)) + public PrinceOptions(string baseurl = default(string), bool? noXinclude = default(bool?), bool? noNetwork = default(bool?), bool? noParallelDownloads = default(bool?), string httpUser = default(string), string httpPassword = default(string), string httpProxy = default(string), int? httpTimeout = default(int?), bool? insecure = default(bool?), string media = "print", bool? noAuthorStyle = default(bool?), bool? noDefaultStyle = default(bool?), bool? noEmbedFonts = default(bool?), bool? noSubsetFonts = default(bool?), bool? noCompress = default(bool?), bool? encrypt = default(bool?), int? keyBits = default(int?), string userPassword = default(string), string ownerPassword = default(string), bool? disallowPrint = default(bool?), bool? disallowCopy = default(bool?), bool? disallowAnnotate = default(bool?), bool? disallowModify = default(bool?), bool? debug = default(bool?), InputEnum? input = InputEnum.Html, string version = default(string), bool? javascript = default(bool?), int? cssDpi = default(int?), string profile = default(string), string pdfTitle = default(string)) { - this.Iframes = iframes; this.Baseurl = baseurl; this.NoXinclude = noXinclude; this.NoNetwork = noNetwork; @@ -135,7 +101,15 @@ public enum InputEnum this.HttpProxy = httpProxy; this.HttpTimeout = httpTimeout; this.Insecure = insecure; - this.Media = media; + // use default value if no "media" provided + if (media == null) + { + this.Media = "print"; + } + else + { + this.Media = media; + } this.NoAuthorStyle = noAuthorStyle; this.NoDefaultStyle = noDefaultStyle; this.NoEmbedFonts = noEmbedFonts; @@ -150,15 +124,20 @@ public enum InputEnum this.DisallowAnnotate = disallowAnnotate; this.DisallowModify = disallowModify; this.Debug = debug; - this.Input = input; - this._Version = version; + // use default value if no "input" provided + if (input == null) + { + this.Input = InputEnum.Html; + } + else + { + this.Input = input; + } + this.Version = version; this.Javascript = javascript; this.CssDpi = cssDpi; this.Profile = profile; this.PdfTitle = pdfTitle; - this.Iframes = iframes; - this.PageMargin = pageMargin; - this.PdfForms = pdfForms; } /// @@ -173,21 +152,21 @@ public enum InputEnum /// /// Disable XML inclusion. [DataMember(Name="no_xinclude", EmitDefaultValue=false)] - public bool NoXinclude { get; set; } + public bool? NoXinclude { get; set; } /// /// Disable network access. /// /// Disable network access. [DataMember(Name="no_network", EmitDefaultValue=false)] - public bool NoNetwork { get; set; } + public bool? NoNetwork { get; set; } /// /// Disables parallel fetching of assets during PDF creation. Useful if your asset host has strict rate limiting. /// /// Disables parallel fetching of assets during PDF creation. Useful if your asset host has strict rate limiting. [DataMember(Name="no_parallel_downloads", EmitDefaultValue=false)] - public bool NoParallelDownloads { get; set; } + public bool? NoParallelDownloads { get; set; } /// /// Set the user for HTTP authentication. @@ -215,14 +194,14 @@ public enum InputEnum /// /// Set the HTTP request timeout. [DataMember(Name="http_timeout", EmitDefaultValue=false)] - public int HttpTimeout { get; set; } + public int? HttpTimeout { get; set; } /// /// Disable SSL verification. /// /// Disable SSL verification. [DataMember(Name="insecure", EmitDefaultValue=false)] - public bool Insecure { get; set; } + public bool? Insecure { get; set; } /// /// Specify the CSS media type. Defaults to \"print\" but you may want to use \"screen\" for web styles. @@ -236,43 +215,49 @@ public enum InputEnum /// /// Ignore author stylesheets. [DataMember(Name="no_author_style", EmitDefaultValue=false)] - public bool NoAuthorStyle { get; set; } + public bool? NoAuthorStyle { get; set; } /// /// Ignore default stylesheets. /// /// Ignore default stylesheets. [DataMember(Name="no_default_style", EmitDefaultValue=false)] - public bool NoDefaultStyle { get; set; } + public bool? NoDefaultStyle { get; set; } /// /// Disable font embedding in PDFs. /// /// Disable font embedding in PDFs. [DataMember(Name="no_embed_fonts", EmitDefaultValue=false)] - public bool NoEmbedFonts { get; set; } + public bool? NoEmbedFonts { get; set; } /// /// Disable font subsetting in PDFs. /// /// Disable font subsetting in PDFs. [DataMember(Name="no_subset_fonts", EmitDefaultValue=false)] - public bool NoSubsetFonts { get; set; } + public bool? NoSubsetFonts { get; set; } /// /// Disable PDF compression. /// /// Disable PDF compression. [DataMember(Name="no_compress", EmitDefaultValue=false)] - public bool NoCompress { get; set; } + public bool? NoCompress { get; set; } /// /// Encrypt PDF output. /// /// Encrypt PDF output. [DataMember(Name="encrypt", EmitDefaultValue=false)] - public bool Encrypt { get; set; } + public bool? Encrypt { get; set; } + /// + /// Set encryption key size. + /// + /// Set encryption key size. + [DataMember(Name="key_bits", EmitDefaultValue=false)] + public int? KeyBits { get; set; } /// /// Set the PDF user password. @@ -293,35 +278,35 @@ public enum InputEnum /// /// Disallow printing of this PDF. [DataMember(Name="disallow_print", EmitDefaultValue=false)] - public bool DisallowPrint { get; set; } + public bool? DisallowPrint { get; set; } /// /// Disallow copying of this PDF. /// /// Disallow copying of this PDF. [DataMember(Name="disallow_copy", EmitDefaultValue=false)] - public bool DisallowCopy { get; set; } + public bool? DisallowCopy { get; set; } /// /// Disallow annotation of this PDF. /// /// Disallow annotation of this PDF. [DataMember(Name="disallow_annotate", EmitDefaultValue=false)] - public bool DisallowAnnotate { get; set; } + public bool? DisallowAnnotate { get; set; } /// /// Disallow modification of this PDF. /// /// Disallow modification of this PDF. [DataMember(Name="disallow_modify", EmitDefaultValue=false)] - public bool DisallowModify { get; set; } + public bool? DisallowModify { get; set; } /// /// Enable Prince debug mode. /// /// Enable Prince debug mode. [DataMember(Name="debug", EmitDefaultValue=false)] - public bool Debug { get; set; } + public bool? Debug { get; set; } /// @@ -329,22 +314,21 @@ public enum InputEnum /// /// Deprecated, use the appropriate `pipeline` version. Specify a specific verison of PrinceXML to use. [DataMember(Name="version", EmitDefaultValue=false)] - [Obsolete] - public string _Version { get; set; } + public string Version { get; set; } /// /// Enable PrinceXML JavaScript. DocRaptor JavaScript parsing is also available elsewhere. /// /// Enable PrinceXML JavaScript. DocRaptor JavaScript parsing is also available elsewhere. [DataMember(Name="javascript", EmitDefaultValue=false)] - public bool Javascript { get; set; } + public bool? Javascript { get; set; } /// /// Set the DPI when rendering CSS. Defaults to 96 but can be set with Prince 9.0 and up. /// /// Set the DPI when rendering CSS. Defaults to 96 but can be set with Prince 9.0 and up. [DataMember(Name="css_dpi", EmitDefaultValue=false)] - public int CssDpi { get; set; } + public int? CssDpi { get; set; } /// /// In Prince 9.0 and up you can set the PDF profile. @@ -360,27 +344,6 @@ public enum InputEnum [DataMember(Name="pdf_title", EmitDefaultValue=false)] public string PdfTitle { get; set; } - /// - /// Enable loading of iframes. - /// - /// Enable loading of iframes. - [DataMember(Name="iframes", EmitDefaultValue=true)] - public bool? Iframes { get; set; } - - /// - /// Specify the page margin distance. - /// - /// Specify the page margin distance. - [DataMember(Name="page_margin", EmitDefaultValue=false)] - public string PageMargin { get; set; } - - /// - /// Make form fields editable by default. - /// - /// Make form fields editable by default. - [DataMember(Name="pdf_forms", EmitDefaultValue=false)] - public bool PdfForms { get; set; } - /// /// Returns the string presentation of the object /// @@ -414,14 +377,11 @@ public override string ToString() sb.Append(" DisallowModify: ").Append(DisallowModify).Append("\n"); sb.Append(" Debug: ").Append(Debug).Append("\n"); sb.Append(" Input: ").Append(Input).Append("\n"); - sb.Append(" _Version: ").Append(_Version).Append("\n"); + sb.Append(" Version: ").Append(Version).Append("\n"); sb.Append(" Javascript: ").Append(Javascript).Append("\n"); sb.Append(" CssDpi: ").Append(CssDpi).Append("\n"); sb.Append(" Profile: ").Append(Profile).Append("\n"); sb.Append(" PdfTitle: ").Append(PdfTitle).Append("\n"); - sb.Append(" Iframes: ").Append(Iframes).Append("\n"); - sb.Append(" PageMargin: ").Append(PageMargin).Append("\n"); - sb.Append(" PdfForms: ").Append(PdfForms).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -432,7 +392,7 @@ public override string ToString() /// JSON string presentation of the object public virtual string ToJson() { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + return JsonConvert.SerializeObject(this, Formatting.Indented); } /// @@ -582,9 +542,9 @@ public bool Equals(PrinceOptions input) this.Input.Equals(input.Input)) ) && ( - this._Version == input._Version || - (this._Version != null && - this._Version.Equals(input._Version)) + this.Version == input.Version || + (this.Version != null && + this.Version.Equals(input.Version)) ) && ( this.Javascript == input.Javascript || @@ -605,21 +565,6 @@ public bool Equals(PrinceOptions input) this.PdfTitle == input.PdfTitle || (this.PdfTitle != null && this.PdfTitle.Equals(input.PdfTitle)) - ) && - ( - this.Iframes == input.Iframes || - (this.Iframes != null && - this.Iframes.Equals(input.Iframes)) - ) && - ( - this.PageMargin == input.PageMargin || - (this.PageMargin != null && - this.PageMargin.Equals(input.PageMargin)) - ) && - ( - this.PdfForms == input.PdfForms || - (this.PdfForms != null && - this.PdfForms.Equals(input.PdfForms)) ); } @@ -682,8 +627,8 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.Debug.GetHashCode(); if (this.Input != null) hashCode = hashCode * 59 + this.Input.GetHashCode(); - if (this._Version != null) - hashCode = hashCode * 59 + this._Version.GetHashCode(); + if (this.Version != null) + hashCode = hashCode * 59 + this.Version.GetHashCode(); if (this.Javascript != null) hashCode = hashCode * 59 + this.Javascript.GetHashCode(); if (this.CssDpi != null) @@ -692,12 +637,6 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.Profile.GetHashCode(); if (this.PdfTitle != null) hashCode = hashCode * 59 + this.PdfTitle.GetHashCode(); - if (this.Iframes != null) - hashCode = hashCode * 59 + this.Iframes.GetHashCode(); - if (this.PageMargin != null) - hashCode = hashCode * 59 + this.PageMargin.GetHashCode(); - if (this.PdfForms != null) - hashCode = hashCode * 59 + this.PdfForms.GetHashCode(); return hashCode; } } diff --git a/src/DocRaptor/Properties/AssemblyInfo.cs b/src/DocRaptor/Properties/AssemblyInfo.cs deleted file mode 100644 index 08b5b71..0000000 --- a/src/DocRaptor/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("OpenAPI Library")] -[assembly: AssemblyDescription("A library generated from a OpenAPI doc")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("OpenAPI")] -[assembly: AssemblyProduct("OpenAPILibrary")] -[assembly: AssemblyCopyright("No Copyright")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("4.0.0")] -[assembly: AssemblyFileVersion("4.0.0")] diff --git a/src/DocRaptor/packages.config b/src/DocRaptor/packages.config deleted file mode 100644 index a3a1bab..0000000 --- a/src/DocRaptor/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - -