Excel export
This commit is contained in:
		| @@ -1722,6 +1722,129 @@ namespace VisaApiClient | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Returns application | ||||
|         /// </summary> | ||||
|         /// <remarks> | ||||
|         /// Accessible only for applicant | ||||
|         /// </remarks> | ||||
|         /// <returns>Success</returns> | ||||
|         /// <exception cref="ApiException">A server side error occurred.</exception> | ||||
|         public virtual System.Threading.Tasks.Task<FileResponse> DownloadApplicationForApplicantAsync(System.Guid applicationId) | ||||
|         { | ||||
|             return DownloadApplicationForApplicantAsync(applicationId, System.Threading.CancellationToken.None); | ||||
|         } | ||||
|  | ||||
|         /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param> | ||||
|         /// <summary> | ||||
|         /// Returns application | ||||
|         /// </summary> | ||||
|         /// <remarks> | ||||
|         /// Accessible only for applicant | ||||
|         /// </remarks> | ||||
|         /// <returns>Success</returns> | ||||
|         /// <exception cref="ApiException">A server side error occurred.</exception> | ||||
|         public virtual async System.Threading.Tasks.Task<FileResponse> DownloadApplicationForApplicantAsync(System.Guid applicationId, System.Threading.CancellationToken cancellationToken) | ||||
|         { | ||||
|             if (applicationId == null) | ||||
|                 throw new System.ArgumentNullException("applicationId"); | ||||
|  | ||||
|             var client_ = _httpClient; | ||||
|             var disposeClient_ = false; | ||||
|             try | ||||
|             { | ||||
|                 using (var request_ = await CreateHttpRequestMessageAsync(cancellationToken).ConfigureAwait(false)) | ||||
|                 { | ||||
|                     request_.Method = new System.Net.Http.HttpMethod("GET"); | ||||
|                     request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/octet-stream")); | ||||
|  | ||||
|                     var urlBuilder_ = new System.Text.StringBuilder(); | ||||
|                     if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); | ||||
|                     // Operation Path: "forApplicant/{applicationId}/download" | ||||
|                     urlBuilder_.Append("forApplicant/"); | ||||
|                     urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(applicationId, System.Globalization.CultureInfo.InvariantCulture))); | ||||
|                     urlBuilder_.Append("/download"); | ||||
|  | ||||
|                     await PrepareRequestAsync(client_, request_, urlBuilder_, cancellationToken).ConfigureAwait(false); | ||||
|  | ||||
|                     var url_ = urlBuilder_.ToString(); | ||||
|                     request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); | ||||
|  | ||||
|                     await PrepareRequestAsync(client_, request_, url_, cancellationToken).ConfigureAwait(false); | ||||
|  | ||||
|                     var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); | ||||
|                     var disposeResponse_ = true; | ||||
|                     try | ||||
|                     { | ||||
|                         var headers_ = new System.Collections.Generic.Dictionary<string, System.Collections.Generic.IEnumerable<string>>(); | ||||
|                         foreach (var item_ in response_.Headers) | ||||
|                             headers_[item_.Key] = item_.Value; | ||||
|                         if (response_.Content != null && response_.Content.Headers != null) | ||||
|                         { | ||||
|                             foreach (var item_ in response_.Content.Headers) | ||||
|                                 headers_[item_.Key] = item_.Value; | ||||
|                         } | ||||
|  | ||||
|                         await ProcessResponseAsync(client_, response_, cancellationToken).ConfigureAwait(false); | ||||
|  | ||||
|                         var status_ = (int)response_.StatusCode; | ||||
|                         if (status_ == 200 || status_ == 206) | ||||
|                         { | ||||
|                             var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false); | ||||
|                             var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_); | ||||
|                             disposeClient_ = false; disposeResponse_ = false; // response and client are disposed by FileResponse | ||||
|                             return fileResponse_; | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 401) | ||||
|                         { | ||||
|                             var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false); | ||||
|                             if (objectResponse_.Object == null) | ||||
|                             { | ||||
|                                 throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); | ||||
|                             } | ||||
|                             throw new ApiException<ProblemDetails>("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 403) | ||||
|                         { | ||||
|                             var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false); | ||||
|                             if (objectResponse_.Object == null) | ||||
|                             { | ||||
|                                 throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); | ||||
|                             } | ||||
|                             throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         if (status_ == 404) | ||||
|                         { | ||||
|                             var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false); | ||||
|                             if (objectResponse_.Object == null) | ||||
|                             { | ||||
|                                 throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); | ||||
|                             } | ||||
|                             throw new ApiException<ProblemDetails>("Not Found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); | ||||
|                         } | ||||
|                         else | ||||
|                         { | ||||
|                             var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); | ||||
|                             throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); | ||||
|                         } | ||||
|                     } | ||||
|                     finally | ||||
|                     { | ||||
|                         if (disposeResponse_) | ||||
|                             response_.Dispose(); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|             finally | ||||
|             { | ||||
|                 if (disposeClient_) | ||||
|                     client_.Dispose(); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         protected struct ObjectResponseResult<T> | ||||
|         { | ||||
|             public ObjectResponseResult(T responseObject, string responseText) | ||||
| @@ -2443,6 +2566,41 @@ namespace VisaApiClient | ||||
|  | ||||
|     } | ||||
|  | ||||
|     [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] | ||||
|     public partial class FileResponse : System.IDisposable | ||||
|     { | ||||
|         private System.IDisposable? _client; | ||||
|         private System.IDisposable? _response; | ||||
|  | ||||
|         public int StatusCode { get; private set; } | ||||
|  | ||||
|         public System.Collections.Generic.IReadOnlyDictionary<string, System.Collections.Generic.IEnumerable<string>> Headers { get; private set; } | ||||
|  | ||||
|         public System.IO.Stream Stream { get; private set; } | ||||
|  | ||||
|         public bool IsPartial | ||||
|         { | ||||
|             get { return StatusCode == 206; } | ||||
|         } | ||||
|  | ||||
|         public FileResponse(int statusCode, System.Collections.Generic.IReadOnlyDictionary<string, System.Collections.Generic.IEnumerable<string>> headers, System.IO.Stream stream, System.IDisposable? client, System.IDisposable? response) | ||||
|         { | ||||
|             StatusCode = statusCode; | ||||
|             Headers = headers; | ||||
|             Stream = stream; | ||||
|             _client = client; | ||||
|             _response = response; | ||||
|         } | ||||
|  | ||||
|         public void Dispose() | ||||
|         { | ||||
|             Stream.Dispose(); | ||||
|             if (_response != null) | ||||
|                 _response.Dispose(); | ||||
|             if (_client != null) | ||||
|                 _client.Dispose(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|  | ||||
|     [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] | ||||
|   | ||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Reference in New Issue
	
	Block a user