|
| 1 | +/* |
| 2 | + * -------------------------------------------------------------------------------- |
| 3 | + * <copyright company="Aspose" file="SplitTableRequest.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 SplitTableRequest 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 worksheet; |
| 45 | + private String tableName; |
| 46 | + private String splitColumnName; |
| 47 | + private Boolean saveSplitColumn; |
| 48 | + private Boolean toNewWorkbook; |
| 49 | + private Boolean toMultipleFiles; |
| 50 | + private String outPath; |
| 51 | + private String outStorageName; |
| 52 | + private String fontsLocation; |
| 53 | + private String region; |
| 54 | + private String password; |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + private String spreadsheet; |
| 59 | + public SplitTableRequest() |
| 60 | + { |
| 61 | + } |
| 62 | + public SplitTableRequest( String spreadsheet , String worksheet , String tableName , String splitColumnName , Boolean saveSplitColumn , Boolean toNewWorkbook , Boolean toMultipleFiles , String outPath , String outStorageName , String fontsLocation , String region , String password ) { |
| 63 | + this.spreadsheet = spreadsheet; |
| 64 | + this.worksheet = worksheet; |
| 65 | + this.tableName = tableName; |
| 66 | + this.splitColumnName = splitColumnName; |
| 67 | + this.saveSplitColumn = saveSplitColumn; |
| 68 | + this.toNewWorkbook = toNewWorkbook; |
| 69 | + this.toMultipleFiles = toMultipleFiles; |
| 70 | + this.outPath = outPath; |
| 71 | + this.outStorageName = outStorageName; |
| 72 | + this.fontsLocation = fontsLocation; |
| 73 | + this.region = region; |
| 74 | + this.password = password; |
| 75 | + } |
| 76 | + |
| 77 | + public String getWorksheet() { |
| 78 | + return this.worksheet; |
| 79 | + } |
| 80 | + |
| 81 | + public void setWorksheet(String worksheet) { |
| 82 | + this.worksheet = worksheet; |
| 83 | + } |
| 84 | + |
| 85 | + |
| 86 | + public String getTableName() { |
| 87 | + return this.tableName; |
| 88 | + } |
| 89 | + |
| 90 | + public void setTableName(String tableName) { |
| 91 | + this.tableName = tableName; |
| 92 | + } |
| 93 | + |
| 94 | + |
| 95 | + public String getSplitColumnName() { |
| 96 | + return this.splitColumnName; |
| 97 | + } |
| 98 | + |
| 99 | + public void setSplitColumnName(String splitColumnName) { |
| 100 | + this.splitColumnName = splitColumnName; |
| 101 | + } |
| 102 | + |
| 103 | + |
| 104 | + public Boolean getSaveSplitColumn() { |
| 105 | + return this.saveSplitColumn; |
| 106 | + } |
| 107 | + |
| 108 | + public void setSaveSplitColumn(Boolean saveSplitColumn) { |
| 109 | + this.saveSplitColumn = saveSplitColumn; |
| 110 | + } |
| 111 | + |
| 112 | + |
| 113 | + public Boolean getToNewWorkbook() { |
| 114 | + return this.toNewWorkbook; |
| 115 | + } |
| 116 | + |
| 117 | + public void setToNewWorkbook(Boolean toNewWorkbook) { |
| 118 | + this.toNewWorkbook = toNewWorkbook; |
| 119 | + } |
| 120 | + |
| 121 | + |
| 122 | + public Boolean getToMultipleFiles() { |
| 123 | + return this.toMultipleFiles; |
| 124 | + } |
| 125 | + |
| 126 | + public void setToMultipleFiles(Boolean toMultipleFiles) { |
| 127 | + this.toMultipleFiles = toMultipleFiles; |
| 128 | + } |
| 129 | + |
| 130 | + |
| 131 | + public String getOutPath() { |
| 132 | + return this.outPath; |
| 133 | + } |
| 134 | + |
| 135 | + public void setOutPath(String outPath) { |
| 136 | + this.outPath = outPath; |
| 137 | + } |
| 138 | + |
| 139 | + |
| 140 | + public String getOutStorageName() { |
| 141 | + return this.outStorageName; |
| 142 | + } |
| 143 | + |
| 144 | + public void setOutStorageName(String outStorageName) { |
| 145 | + this.outStorageName = outStorageName; |
| 146 | + } |
| 147 | + |
| 148 | + |
| 149 | + public String getFontsLocation() { |
| 150 | + return this.fontsLocation; |
| 151 | + } |
| 152 | + |
| 153 | + public void setFontsLocation(String fontsLocation) { |
| 154 | + this.fontsLocation = fontsLocation; |
| 155 | + } |
| 156 | + |
| 157 | + |
| 158 | + public String getRegion() { |
| 159 | + return this.region; |
| 160 | + } |
| 161 | + |
| 162 | + public void setRegion(String region) { |
| 163 | + this.region = region; |
| 164 | + } |
| 165 | + |
| 166 | + |
| 167 | + public String getPassword() { |
| 168 | + return this.password; |
| 169 | + } |
| 170 | + |
| 171 | + public void setPassword(String password) { |
| 172 | + this.password = password; |
| 173 | + } |
| 174 | + |
| 175 | + |
| 176 | + |
| 177 | + public String getSpreadsheet() { |
| 178 | + return this.spreadsheet; |
| 179 | + } |
| 180 | + public void setSpreadsheet(String spreadsheet) { |
| 181 | + this.spreadsheet = spreadsheet; |
| 182 | + } |
| 183 | + |
| 184 | + |
| 185 | + @Override |
| 186 | + public Call buildHttpRequest(ApiClient apiClient, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener, Boolean addAuthHeaders) throws ApiException { |
| 187 | + |
| 188 | + |
| 189 | + if ( getSpreadsheet() == null ) { |
| 190 | + throw new ApiException("Missing the required parameter 'Spreadsheet' when calling SplitTable"); |
| 191 | + } |
| 192 | + |
| 193 | + if (getWorksheet() == null) { |
| 194 | + throw new ApiException("Missing the required parameter 'Worksheet' when calling SplitTable"); |
| 195 | + } |
| 196 | + |
| 197 | + if (getTableName() == null) { |
| 198 | + throw new ApiException("Missing the required parameter 'TableName' when calling SplitTable"); |
| 199 | + } |
| 200 | + |
| 201 | + if (getSplitColumnName() == null) { |
| 202 | + throw new ApiException("Missing the required parameter 'SplitColumnName' when calling SplitTable"); |
| 203 | + } |
| 204 | + |
| 205 | + if (getSaveSplitColumn() == null) { |
| 206 | + throw new ApiException("Missing the required parameter 'SaveSplitColumn' when calling SplitTable"); |
| 207 | + } |
| 208 | + |
| 209 | + if (getToNewWorkbook() == null) { |
| 210 | + throw new ApiException("Missing the required parameter 'ToNewWorkbook' when calling SplitTable"); |
| 211 | + } |
| 212 | + |
| 213 | + if (getToMultipleFiles() == null) { |
| 214 | + throw new ApiException("Missing the required parameter 'ToMultipleFiles' when calling SplitTable"); |
| 215 | + } |
| 216 | + String localVarPath = "v4.0/cells/split/table"; |
| 217 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 218 | + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); |
| 219 | + List<Pair> localVarQueryParams = new ArrayList<Pair>(); |
| 220 | + if (getWorksheet() != null){ |
| 221 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", "worksheet", getWorksheet())); |
| 222 | + } |
| 223 | + if (getTableName() != null){ |
| 224 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", "tableName", getTableName())); |
| 225 | + } |
| 226 | + if (getSplitColumnName() != null){ |
| 227 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", "splitColumnName", getSplitColumnName())); |
| 228 | + } |
| 229 | + if (getSaveSplitColumn() != null){ |
| 230 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", "saveSplitColumn", getSaveSplitColumn())); |
| 231 | + } |
| 232 | + if (getToNewWorkbook() != null){ |
| 233 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", "toNewWorkbook", getToNewWorkbook())); |
| 234 | + } |
| 235 | + if (getToMultipleFiles() != null){ |
| 236 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", "toMultipleFiles", getToMultipleFiles())); |
| 237 | + } |
| 238 | + if (getOutPath() != null){ |
| 239 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", "outPath", getOutPath())); |
| 240 | + } |
| 241 | + if (getOutStorageName() != null){ |
| 242 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", "outStorageName", getOutStorageName())); |
| 243 | + } |
| 244 | + if (getFontsLocation() != null){ |
| 245 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", "fontsLocation", getFontsLocation())); |
| 246 | + } |
| 247 | + if (getRegion() != null){ |
| 248 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", "region", getRegion())); |
| 249 | + } |
| 250 | + if (getPassword() != null){ |
| 251 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", "password", getPassword())); |
| 252 | + } |
| 253 | + if(this.extendQueryParameterMap !=null){ |
| 254 | + for (String key :this.extendQueryParameterMap.keySet()) { |
| 255 | + localVarQueryParams.addAll(apiClient.parameterToPairs("", key, this.extendQueryParameterMap.get(key))); |
| 256 | + } |
| 257 | + } |
| 258 | + |
| 259 | + File SpreadsheetToUpload = new File(getSpreadsheet()); |
| 260 | + if (SpreadsheetToUpload.exists()) { |
| 261 | + localVarFormParams.put(SpreadsheetToUpload.getName(), SpreadsheetToUpload); |
| 262 | + } |
| 263 | + |
| 264 | + Object localVarPostBody = null; |
| 265 | + final String[] localVarAccepts = { |
| 266 | + "application/json" |
| 267 | + }; |
| 268 | + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); |
| 269 | + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); |
| 270 | + |
| 271 | + final String[] localVarContentTypes = { "multipart/form-data" }; |
| 272 | + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); |
| 273 | + localVarHeaderParams.put("Content-Type", localVarContentType); |
| 274 | + |
| 275 | + if(progressListener != null) { |
| 276 | + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { |
| 277 | + @Override |
| 278 | + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { |
| 279 | + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); |
| 280 | + return originalResponse.newBuilder() |
| 281 | + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) |
| 282 | + .build(); |
| 283 | + } |
| 284 | + }); |
| 285 | + } |
| 286 | + |
| 287 | + String[] localVarAuthNames = new String[] { }; |
| 288 | + return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); |
| 289 | + |
| 290 | + } |
| 291 | +} |
| 292 | + |
0 commit comments