|
| 1 | +// -------------------------------------------------------------------------------------------------------------------- |
| 2 | +// <copyright company="Aspose" file="PostRepairRequest.cs"> |
| 3 | +// Copyright (c) 2023 Aspose.Cells Cloud |
| 4 | +// </copyright> |
| 5 | +// <summary> |
| 6 | +// Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | +// of this software and associated documentation files (the "Software"), to deal |
| 8 | +// in the Software without restriction, including without limitation the rights |
| 9 | +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | +// copies of the Software, and to permit persons to whom the Software is |
| 11 | +// furnished to do so, subject to the following conditions: |
| 12 | +// |
| 13 | +// The above copyright notice and this permission notice shall be included in all |
| 14 | +// copies or substantial portions of the Software. |
| 15 | +// |
| 16 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | +// SOFTWARE. |
| 23 | +// </summary> |
| 24 | +// -------------------------------------------------------------------------------------------------------------------- |
| 25 | + |
| 26 | +namespace Aspose.Cells.Cloud.SDK.Request |
| 27 | +{ |
| 28 | + using Aspose.Cells.Cloud.SDK.Model; |
| 29 | + using Newtonsoft.Json; |
| 30 | + using System.Collections.Generic; |
| 31 | + using System.Net; |
| 32 | + using System.Text.RegularExpressions; |
| 33 | + |
| 34 | + /// <summary> |
| 35 | + /// Request model for <see cref="Aspose.Cells.Cloud.SDK.Api.CellsApi.PostRepair" /> operation. |
| 36 | + /// </summary> |
| 37 | + public class PostRepairRequest : IRequestModel |
| 38 | + { |
| 39 | + /// <summary> |
| 40 | + /// Initializes a new instance of the <see cref="PostRepairRequest"/> class. |
| 41 | + /// </summary> |
| 42 | + public PostRepairRequest() |
| 43 | + { |
| 44 | + |
| 45 | + } |
| 46 | + |
| 47 | + /// <summary> |
| 48 | + /// Initializes a new instance of the <see cref="PostRepairRequest"/> class. |
| 49 | + /// </summary> |
| 50 | + /// <param name="file">File to upload</param> |
| 51 | + /// <param name="format"></param> |
| 52 | + public PostRepairRequest(IDictionary<string, System.IO.Stream> file, string format = null) |
| 53 | + { |
| 54 | + this.File = file; |
| 55 | + this.format = format; |
| 56 | + } |
| 57 | + |
| 58 | + /// <summary> |
| 59 | + /// File to upload |
| 60 | + /// </summary> |
| 61 | + public IDictionary<string, System.IO.Stream> File { get; set; } |
| 62 | + |
| 63 | + /// <summary> |
| 64 | + /// Gets or sets format. |
| 65 | + /// </summary> |
| 66 | + public string format { get; set; } |
| 67 | + |
| 68 | + |
| 69 | + /// <summary> |
| 70 | + /// Gets or sets extendQueryParameterMap. |
| 71 | + /// </summary> |
| 72 | + public IDictionary<string, string> extendQueryParameterMap ; |
| 73 | + |
| 74 | + /// <summary> |
| 75 | + /// Creates the http request based on this request. |
| 76 | + /// </summary> |
| 77 | + /// <param name="baseUri">Api base uri.</param> |
| 78 | + /// <returns>The http request instance.</returns> |
| 79 | + public HttpWebRequest CreateHttpRequest(string baseUri,IDictionary<string, string> defaultHeaderMap, List<Invoker.IRequestHandler> requestHandlers) |
| 80 | + { |
| 81 | + var localVarHeaderParams = new Dictionary<string, string>(); |
| 82 | + var localVarFileParams = new Dictionary<string, object>(); |
| 83 | + string localVarPostBody =""; |
| 84 | + string localVarHttpContentType = "application/json"; |
| 85 | + // verify the required parameter 'file' is set |
| 86 | + if ( this.File == null) |
| 87 | + { |
| 88 | + throw new ApiException(400, "Missing required parameter 'file' when calling PostRepair"); |
| 89 | + } |
| 90 | + |
| 91 | + var path = baseUri + "/cells/repair"; |
| 92 | + path = Regex |
| 93 | + .Replace(path, "\\*", string.Empty) |
| 94 | + .Replace("&", "&") |
| 95 | + .Replace("/?", "?"); |
| 96 | + |
| 97 | + if (!string.IsNullOrEmpty(this.format)) path = UrlHelper.AddQueryParameterToUrl(path, "format", this.format); |
| 98 | + if (this.extendQueryParameterMap != null) |
| 99 | + { |
| 100 | + foreach (KeyValuePair<string, string> kvp in extendQueryParameterMap) |
| 101 | + { |
| 102 | + UrlHelper.AddQueryParameterToUrl(path, kvp.Key, kvp.Value); |
| 103 | + } |
| 104 | + } |
| 105 | + |
| 106 | + if( File !=null ){ |
| 107 | + foreach (KeyValuePair<string, System.IO.Stream> keyValueFileParam in File ) |
| 108 | + { |
| 109 | + localVarFileParams.Add(keyValueFileParam.Key, UrlHelper.ToFileInfo(keyValueFileParam.Value, keyValueFileParam.Key)); |
| 110 | + } |
| 111 | + } |
| 112 | + return UrlHelper.PrepareRequest(path, "POST", localVarFileParams, localVarHeaderParams, localVarPostBody, localVarHttpContentType, defaultHeaderMap, requestHandlers); |
| 113 | + } |
| 114 | + } |
| 115 | +} |
0 commit comments