| 1 | =begin comment | ||
| 2 | |||
| 3 | Copyright (c) 2026 Aspose.Cells Cloud | ||
| 4 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 5 | of this software and associated documentation files (the "Software"), to deal | ||
| 6 | in the Software without restriction, including without limitation the rights | ||
| 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 8 | copies of the Software, and to permit persons to whom the Software is | ||
| 9 | furnished to do so, subject to the following conditions: | ||
| 10 | |||
| 11 | The above copyright notice and this permission notice shall be included in all | ||
| 12 | copies or substantial portions of the Software. | ||
| 13 | |||
| 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 20 | SOFTWARE. | ||
| 21 | |||
| 22 | =end comment | ||
| 23 | |||
| 24 | =cut | ||
| 25 | |||
| 26 | package AsposeCellsCloud::Request::TrimCharacterRequest; | ||
| 27 | |||
| 28 | require 5.6.0; | ||
| 29 | use strict; | ||
| 30 | use warnings; | ||
| 31 | use utf8; | ||
| 32 | use JSON ; | ||
| 33 | use Data::Dumper; | ||
| 34 | use Module::Runtime qw(use_module); | ||
| 35 | use Log::Any qw($log); | ||
| 36 | use Date::Parse; | ||
| 37 | use DateTime; | ||
| 38 | use File::Basename; | ||
| 39 | |||
| 40 | use base ("Class::Accessor", "Class::Data::Inheritable"); | ||
| 41 | |||
| 42 | __PACKAGE__->mk_classdata('attribute_map' => {}); | ||
| 43 | __PACKAGE__->mk_classdata('method_documentation' => {}); | ||
| 44 | __PACKAGE__->mk_classdata('class_documentation' => {}); | ||
| 45 | |||
| 46 | |||
| 47 | # new object | ||
| 48 | sub new { | ||
| 49 | my ($class, %args) = @_; | ||
| 50 | |||
| 51 | my $self = bless {}, $class; | ||
| 52 | |||
| 53 | foreach my $attribute (keys %{$class->attribute_map}) { | ||
| 54 | my $args_key = $class->attribute_map->{$attribute}; | ||
| 55 | $self->$attribute( $args{ $args_key } ); | ||
| 56 | } | ||
| 57 | |||
| 58 | return $self; | ||
| 59 | } | ||
| 60 | |||
| 61 | |||
| 62 | # Run Operation Request | ||
| 63 | # TrimCharacterRequest.Spreadsheet : Upload spreadsheet file. , | ||
| 64 | # TrimCharacterRequest.trimContent : Specify the trim content. , | ||
| 65 | # TrimCharacterRequest.trimLeading : Specify to trim content from the beginning. , | ||
| 66 | # TrimCharacterRequest.trimTrailing : Specify to trim content from the end. , | ||
| 67 | # TrimCharacterRequest.trimSpaceBetweenWordTo1 : Remove excess spaces between words within a cell. , | ||
| 68 | # TrimCharacterRequest.trimNonBreakingSpaces : Remove non-breaking spaces. , | ||
| 69 | # TrimCharacterRequest.removeExtraLineBreaks : Remove extra line breaks. , | ||
| 70 | # TrimCharacterRequest.removeAllLineBreaks : Remove all line breaks. , | ||
| 71 | # TrimCharacterRequest.worksheet : Specify the worksheet of spreadsheet. , | ||
| 72 | # TrimCharacterRequest.range : Specify the worksheet range of spreadsheet. , | ||
| 73 | # TrimCharacterRequest.outPath : (Optional) The folder path where the workbook is stored. The default is null. , | ||
| 74 | # TrimCharacterRequest.outStorageName : Output file Storage Name. , | ||
| 75 | # TrimCharacterRequest.region : The spreadsheet region setting. , | ||
| 76 | # TrimCharacterRequest.password : The password for opening spreadsheet file. | ||
| 77 | |||
| 78 | { | ||
| 79 | my $params = { | ||
| 80 | 'client' =>{ | ||
| 81 | data_type => 'ApiClient', | ||
| 82 | description => 'API Client.', | ||
| 83 | required => '0', | ||
| 84 | } | ||
| 85 | }; | ||
| 86 | __PACKAGE__->method_documentation->{ 'trim_character' } = { | ||
| 87 | summary => 'The TrimSpreadsheetContent API is designed to process and trim content within a spreadsheet. This API allows users to remove extra spaces, line breaks, or other unnecessary characters from the content of selected cells. It is particularly useful for cleaning up data entries and ensuring consistency in spreadsheet formatting', | ||
| 88 | params => $params, | ||
| 89 | returns => 'string', | ||
| 90 | }; | ||
| 91 | } | ||
| 92 | |||
| 93 | sub run_http_request { | ||
| 94 | my ($self, %args) = @_; | ||
| 95 | |||
| 96 | my $client = $args{'client'}; | ||
| 97 | |||
| 98 | # parse inputs | ||
| 99 | my $_resource_path = 'v4.0/cells/content/trim'; | ||
| 100 | |||
| 101 | my $_method = 'PUT'; | ||
| 102 | my $query_params = {}; | ||
| 103 | my $header_params = {}; | ||
| 104 | my $form_params = {}; | ||
| 105 | |||
| 106 | |||
| 107 | my $_header_accept = $client->select_header_accept('application/json'); | ||
| 108 | if ($_header_accept) { | ||
| 109 | $header_params->{'Accept'} = $_header_accept; | ||
| 110 | } | ||
| 111 | $header_params->{'Content-Type'} = $client->select_header_content_type('multipart/form-data'); | ||
| 112 | |||
| 113 | if(defined $self->trim_content){ | ||
| 114 | $query_params->{'trimContent'} = $client->to_query_value($self->trim_content); | ||
| 115 | } | ||
| 116 | |||
| 117 | if(defined $self->trim_leading){ | ||
| 118 | $query_params->{'trimLeading'} = $client->to_query_value($self->trim_leading); | ||
| 119 | } | ||
| 120 | |||
| 121 | if(defined $self->trim_trailing){ | ||
| 122 | $query_params->{'trimTrailing'} = $client->to_query_value($self->trim_trailing); | ||
| 123 | } | ||
| 124 | |||
| 125 | if(defined $self->trim_space_between_word_to1){ | ||
| 126 | $query_params->{'trimSpaceBetweenWordTo1'} = $client->to_query_value($self->trim_space_between_word_to1); | ||
| 127 | } | ||
| 128 | |||
| 129 | if(defined $self->trim_non_breaking_spaces){ | ||
| 130 | $query_params->{'trimNonBreakingSpaces'} = $client->to_query_value($self->trim_non_breaking_spaces); | ||
| 131 | } | ||
| 132 | |||
| 133 | if(defined $self->remove_extra_line_breaks){ | ||
| 134 | $query_params->{'removeExtraLineBreaks'} = $client->to_query_value($self->remove_extra_line_breaks); | ||
| 135 | } | ||
| 136 | |||
| 137 | if(defined $self->remove_all_line_breaks){ | ||
| 138 | $query_params->{'removeAllLineBreaks'} = $client->to_query_value($self->remove_all_line_breaks); | ||
| 139 | } | ||
| 140 | |||
| 141 | if(defined $self->worksheet){ | ||
| 142 | $query_params->{'worksheet'} = $client->to_query_value($self->worksheet); | ||
| 143 | } | ||
| 144 | |||
| 145 | if(defined $self->range){ | ||
| 146 | $query_params->{'range'} = $client->to_query_value($self->range); | ||
| 147 | } | ||
| 148 | |||
| 149 | if(defined $self->out_path){ | ||
| 150 | $query_params->{'outPath'} = $client->to_query_value($self->out_path); | ||
| 151 | } | ||
| 152 | |||
| 153 | if(defined $self->out_storage_name){ | ||
| 154 | $query_params->{'outStorageName'} = $client->to_query_value($self->out_storage_name); | ||
| 155 | } | ||
| 156 | |||
| 157 | if(defined $self->region){ | ||
| 158 | $query_params->{'region'} = $client->to_query_value($self->region); | ||
| 159 | } | ||
| 160 | |||
| 161 | if(defined $self->password){ | ||
| 162 | $query_params->{'password'} = $client->to_query_value($self->password); | ||
| 163 | } | ||
| 164 | my $_body_data; | ||
| 165 | |||
| 166 | |||
| 167 | if (defined $self->spreadsheet) { | ||
| 168 | $form_params->{basename($self->spreadsheet)} = [$self->spreadsheet ,basename($self->spreadsheet),'application/octet-stream']; | ||
| 169 | } | ||
| 170 | |||
| 171 | |||
| 172 | # authentication setting, if any | ||
| 173 | my $auth_settings = [qw()]; | ||
| 174 | |||
| 175 | # make the API Call | ||
| 176 | my $response = $client->call_api($_resource_path, $_method, $query_params, $form_params, $header_params, $_body_data, $auth_settings); | ||
| 177 | return $response; | ||
| 178 | } | ||
| 179 | |||
| 180 | |||
| 181 | __PACKAGE__->method_documentation({ | ||
| 182 | 'spreadsheet' => { | ||
| 183 | datatype => 'string', | ||
| 184 | base_name => 'Spreadsheet', | ||
| 185 | description => 'Upload spreadsheet file.', | ||
| 186 | format => '', | ||
| 187 | read_only => '', | ||
| 188 | }, | ||
| 189 | 'trim_content' => { | ||
| 190 | datatype => 'string', | ||
| 191 | base_name => 'trimContent', | ||
| 192 | description => 'Specify the trim content.', | ||
| 193 | format => '', | ||
| 194 | read_only => '', | ||
| 195 | }, | ||
| 196 | 'trim_leading' => { | ||
| 197 | datatype => 'string', | ||
| 198 | base_name => 'trimLeading', | ||
| 199 | description => 'Specify to trim content from the beginning.', | ||
| 200 | format => '', | ||
| 201 | read_only => '', | ||
| 202 | }, | ||
| 203 | 'trim_trailing' => { | ||
| 204 | datatype => 'string', | ||
| 205 | base_name => 'trimTrailing', | ||
| 206 | description => 'Specify to trim content from the end.', | ||
| 207 | format => '', | ||
| 208 | read_only => '', | ||
| 209 | }, | ||
| 210 | 'trim_space_between_word_to1' => { | ||
| 211 | datatype => 'string', | ||
| 212 | base_name => 'trimSpaceBetweenWordTo1', | ||
| 213 | description => 'Remove excess spaces between words within a cell.', | ||
| 214 | format => '', | ||
| 215 | read_only => '', | ||
| 216 | }, | ||
| 217 | 'trim_non_breaking_spaces' => { | ||
| 218 | datatype => 'string', | ||
| 219 | base_name => 'trimNonBreakingSpaces', | ||
| 220 | description => 'Remove non-breaking spaces.', | ||
| 221 | format => '', | ||
| 222 | read_only => '', | ||
| 223 | }, | ||
| 224 | 'remove_extra_line_breaks' => { | ||
| 225 | datatype => 'string', | ||
| 226 | base_name => 'removeExtraLineBreaks', | ||
| 227 | description => 'Remove extra line breaks.', | ||
| 228 | format => '', | ||
| 229 | read_only => '', | ||
| 230 | }, | ||
| 231 | 'remove_all_line_breaks' => { | ||
| 232 | datatype => 'string', | ||
| 233 | base_name => 'removeAllLineBreaks', | ||
| 234 | description => 'Remove all line breaks.', | ||
| 235 | format => '', | ||
| 236 | read_only => '', | ||
| 237 | }, | ||
| 238 | 'worksheet' => { | ||
| 239 | datatype => 'string', | ||
| 240 | base_name => 'worksheet', | ||
| 241 | description => 'Specify the worksheet of spreadsheet.', | ||
| 242 | format => '', | ||
| 243 | read_only => '', | ||
| 244 | }, | ||
| 245 | 'range' => { | ||
| 246 | datatype => 'string', | ||
| 247 | base_name => 'range', | ||
| 248 | description => 'Specify the worksheet range of spreadsheet.', | ||
| 249 | format => '', | ||
| 250 | read_only => '', | ||
| 251 | }, | ||
| 252 | 'out_path' => { | ||
| 253 | datatype => 'string', | ||
| 254 | base_name => 'outPath', | ||
| 255 | description => '(Optional) The folder path where the workbook is stored. The default is null.', | ||
| 256 | format => '', | ||
| 257 | read_only => '', | ||
| 258 | }, | ||
| 259 | 'out_storage_name' => { | ||
| 260 | datatype => 'string', | ||
| 261 | base_name => 'outStorageName', | ||
| 262 | description => 'Output file Storage Name.', | ||
| 263 | format => '', | ||
| 264 | read_only => '', | ||
| 265 | }, | ||
| 266 | 'region' => { | ||
| 267 | datatype => 'string', | ||
| 268 | base_name => 'region', | ||
| 269 | description => 'The spreadsheet region setting.', | ||
| 270 | format => '', | ||
| 271 | read_only => '', | ||
| 272 | }, | ||
| 273 | 'password' => { | ||
| 274 | datatype => 'string', | ||
| 275 | base_name => 'password', | ||
| 276 | description => 'The password for opening spreadsheet file.', | ||
| 277 | format => '', | ||
| 278 | read_only => '', | ||
| 279 | }, | ||
| 280 | }); | ||
| 281 | |||
| 282 | |||
| 283 | __PACKAGE__->attribute_map( { | ||
| 284 | 'spreadsheet' => 'Spreadsheet', | ||
| 285 | 'trim_content' => 'trimContent', | ||
| 286 | 'trim_leading' => 'trimLeading', | ||
| 287 | 'trim_trailing' => 'trimTrailing', | ||
| 288 | 'trim_space_between_word_to1' => 'trimSpaceBetweenWordTo1', | ||
| 289 | 'trim_non_breaking_spaces' => 'trimNonBreakingSpaces', | ||
| 290 | 'remove_extra_line_breaks' => 'removeExtraLineBreaks', | ||
| 291 | 'remove_all_line_breaks' => 'removeAllLineBreaks', | ||
| 292 | 'worksheet' => 'worksheet', | ||
| 293 | 'range' => 'range', | ||
| 294 | 'out_path' => 'outPath', | ||
| 295 | 'out_storage_name' => 'outStorageName', | ||
| 296 | 'region' => 'region', | ||
| 297 | 'password' => 'password' | ||
| 298 | } ); | ||
| 299 | |||
| 300 | __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); | ||
| 301 | |||
| 302 | |||
| 303 | 1; |