|
| 1 | +/* |
| 2 | + * -------------------------------------------------------------------------------- |
| 3 | + * <copyright company="Aspose" file="AddTextRequest.java"> |
| 4 | + * Copyright (c) 2025 Aspose.Cells Cloud |
| 5 | + * </copyright> |
| 6 | + * <summary> |
| 7 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 8 | + * of this software and associated documentation files (the "Software"), to deal |
| 9 | + * in the Software without restriction, including without limitation the rights |
| 10 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 11 | + * copies of the Software, and to permit persons to whom the Software is |
| 12 | + * furnished to do so, subject to the following conditions: |
| 13 | + * |
| 14 | + * The above copyright notice and this permission notice shall be included in all |
| 15 | + * copies or substantial portions of the Software. |
| 16 | + * |
| 17 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 20 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 22 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 23 | + * SOFTWARE. |
| 24 | + * </summary> |
| 25 | + * -------------------------------------------------------------------------------- |
| 26 | + */ |
| 27 | +package com.aspose.cloud.cells.request; |
| 28 | +import com.aspose.cloud.cells.client.*; |
| 29 | +import com.aspose.cloud.cells.model.*; |
| 30 | +import com.squareup.okhttp.*; |
| 31 | +import java.io.*; |
| 32 | +import java.lang.reflect.Type; |
| 33 | +import java.util.*; |
| 34 | + |
| 35 | +public class AddTextRequest implements IRequestModel { |
| 36 | + private HashMap<String,String> extendQueryParameterMap; |
| 37 | + public HashMap<String,String> getExtendQueryParameterMap() { |
| 38 | + return this.extendQueryParameterMap; |
| 39 | + } |
| 40 | + |
| 41 | + public void setExtendQueryParameterMap( HashMap<String,String> extendQueryParameterMap) { |
| 42 | + this.extendQueryParameterMap = extendQueryParameterMap; |
| 43 | + } |
| 44 | + private String text; |
| 45 | + private String position; |
| 46 | + private String selectText; |
| 47 | + private Boolean skipEmptyCells; |
| 48 | + private String worksheet; |
| 49 | + private String range; |
| 50 | + private String outPath; |
| 51 | + private String outStorageName; |
| 52 | + private String region; |
| 53 | + private String password; |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + private String spreadsheet; |
| 58 | + public AddTextRequest() |
| 59 | + { |
| 60 | + } |
| 61 | + public AddTextRequest( String spreadsheet , String text , String position , String selectText , Boolean skipEmptyCells , String worksheet , String range , String outPath , String outStorageName , String region , String password ) { |
| 62 | + this.spreadsheet = spreadsheet; |
| 63 | + this.text = text; |
| 64 | + this.position = position; |
| 65 | + this.selectText = selectText; |
| 66 | + this.skipEmptyCells = skipEmptyCells; |
| 67 | + this.worksheet = worksheet; |
| 68 | + this.range = range; |
| 69 | + this.outPath = outPath; |
| 70 | + this.outStorageName = outStorageName; |
| 71 | + this.region = region; |
| 72 | + this.password = password; |
| 73 | + } |
| 74 | + |
| 75 | + public String getText() { |
| 76 | + return this.text; |
| 77 | + } |
| 78 | + |
| 79 | + public void setText(String text) { |
| 80 | + this.text = text; |
| 81 | + } |
| 82 | + |
| 83 | + |
| 84 | + public String getPosition() { |
| 85 | + return this.position; |
| 86 | + } |
| 87 | + |
| 88 | + public void setPosition(String position) { |
| 89 | + this.position = position; |
| 90 | + } |
| 91 | + |
| 92 | + |
| 93 | + public String getSelectText() { |
| 94 | + return this.selectText; |
| 95 | + } |
| 96 | + |
| 97 | + public void setSelectText(String selectText) { |
| 98 | + this.selectText = selectText; |
| 99 | + } |
| 100 | + |
| 101 | + |
| 102 | + public Boolean getSkipEmptyCells() { |
| 103 | + return this.skipEmptyCells; |
| 104 | + } |
| 105 | + |
| 106 | + public void setSkipEmptyCells(Boolean skipEmptyCells) { |
| 107 | + this.skipEmptyCells = skipEmptyCells; |
| 108 | + } |
| 109 | + |
| 110 | + |
| 111 | + public String getWorksheet() { |
| 112 | + return this.worksheet; |
| 113 | + } |
| 114 | + |
| 115 | + public void setWorksheet(String worksheet) { |
| 116 | + this.worksheet = worksheet; |
| 117 | + } |
| 118 | + |
| 119 | + |
| 120 | + public String getRange() { |
| 121 | + return this.range; |
| 122 | + } |
| 123 | + |
| 124 | + public void setRange(String range) { |
| 125 | + this.range = range; |
| 126 | + } |
| 127 | + |
| 128 | + |
| 129 | + public String getOutPath() { |
| 130 | + return this.outPath; |
| 131 | + } |
| 132 | + |
| 133 | + public void setOutPath(String outPath) { |
| 134 | + this.outPath = outPath; |
| 135 | + } |
| 136 | + |
| 137 | + |
| 138 | + public String getOutStorageName() { |
| 139 | + return this.outStorageName; |
| 140 | + } |
| 141 | + |
| 142 | + public void setOutStorageName(String outStorageName) { |
| 143 | + this.outStorageName = outStorageName; |
| 144 | + } |
| 145 | + |
| 146 | + |
| 147 | + public String getRegion() { |
| 148 | + return this.region; |
| 149 | + } |
| 150 | + |
| 151 | + public void setRegion(String region) { |
| 152 | + this.region = region; |
| 153 | + } |
| 154 | + |
| 155 | + |
| 156 | + public String getPassword() { |
| 157 | + return this.password; |
| 158 | + } |
| 159 | + |
| 160 | + public void setPassword(String password) { |
| 161 | + this.password = password; |
| 162 | + } |
| 163 | + |
| 164 | + |
| 165 | + |
| 166 | + public String getSpreadsheet() { |
| 167 | + return this.spreadsheet; |
| 168 | + } |
| 169 | + public void setSpreadsheet(String spreadsheet) { |
| 170 | + this.spreadsheet = spreadsheet; |
| 171 | + } |
| 172 | + |
| 173 | + |
| 174 | + @Override |
| 175 | + public Call buildHttpRequest(ApiClient apiClient, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener, Boolean addAuthHeaders) throws ApiException { |
| 176 | + |
| 177 | + |
| 178 | + if ( getSpreadsheet() == null ) { |
| 179 | + throw new ApiException("Missing the required parameter 'Spreadsheet' when calling AddText"); |
| 180 | + } |
| 181 | + |
| 182 | + if (getText() == null) { |
| 183 | + throw new ApiException("Missing the required parameter 'Text' when calling AddText"); |
| 184 | + } |
| 185 | + |
| 186 | + if (getPosition() == null) { |
| 187 | + throw new ApiException("Missing the required parameter 'Position' when calling AddText"); |
| 188 | + } |
| 189 | + |
| 190 | + if (getSelectText() == null) { |
| 191 | + throw new ApiException("Missing the required parameter 'SelectText' when calling AddText"); |
| 192 | + } |
| 193 | + String localVarPath = "v4.0/cells/content/add/text"; |
| 194 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 195 | + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); |
| 196 | + List<Pair> localVarQueryParams = new ArrayList<Pair>(); |
| 197 | + if (getText() != null){ |
| 198 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", "text", getText())); |
| 199 | + } |
| 200 | + if (getPosition() != null){ |
| 201 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", "position", getPosition())); |
| 202 | + } |
| 203 | + if (getSelectText() != null){ |
| 204 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", "selectText", getSelectText())); |
| 205 | + } |
| 206 | + if (getSkipEmptyCells() != null){ |
| 207 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", "skipEmptyCells", getSkipEmptyCells())); |
| 208 | + } |
| 209 | + if (getWorksheet() != null){ |
| 210 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", "worksheet", getWorksheet())); |
| 211 | + } |
| 212 | + if (getRange() != null){ |
| 213 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", "range", getRange())); |
| 214 | + } |
| 215 | + if (getOutPath() != null){ |
| 216 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", "outPath", getOutPath())); |
| 217 | + } |
| 218 | + if (getOutStorageName() != null){ |
| 219 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", "outStorageName", getOutStorageName())); |
| 220 | + } |
| 221 | + if (getRegion() != null){ |
| 222 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", "region", getRegion())); |
| 223 | + } |
| 224 | + if (getPassword() != null){ |
| 225 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", "password", getPassword())); |
| 226 | + } |
| 227 | + if(this.extendQueryParameterMap !=null){ |
| 228 | + for (String key :this.extendQueryParameterMap.keySet()) { |
| 229 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", key, this.extendQueryParameterMap.get(key))); |
| 230 | + } |
| 231 | + } |
| 232 | + |
| 233 | + File SpreadsheetToUpload = new File(getSpreadsheet()); |
| 234 | + if (SpreadsheetToUpload.exists()) { |
| 235 | + localVarFormParams.put(SpreadsheetToUpload.getName(), SpreadsheetToUpload); |
| 236 | + } |
| 237 | + |
| 238 | + Object localVarPostBody = null; |
| 239 | + final String[] localVarAccepts = { |
| 240 | + "application/json" |
| 241 | + }; |
| 242 | + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); |
| 243 | + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); |
| 244 | + |
| 245 | + final String[] localVarContentTypes = { "multipart/form-data" }; |
| 246 | + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); |
| 247 | + localVarHeaderParams.put("Content-Type", localVarContentType); |
| 248 | + |
| 249 | + if(progressListener != null) { |
| 250 | + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { |
| 251 | + @Override |
| 252 | + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { |
| 253 | + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); |
| 254 | + return originalResponse.newBuilder() |
| 255 | + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) |
| 256 | + .build(); |
| 257 | + } |
| 258 | + }); |
| 259 | + } |
| 260 | + |
| 261 | + String[] localVarAuthNames = new String[] { }; |
| 262 | + return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); |
| 263 | + |
| 264 | + } |
| 265 | +} |
| 266 | + |
0 commit comments