| 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::RemoveCharactersByPositionRequest; | ||
| 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 | # RemoveCharactersByPositionRequest.Spreadsheet : Upload spreadsheet file. , | ||
| 64 | # RemoveCharactersByPositionRequest.theFirstNCharacters : Specify removing the first n characters from selected cells. , | ||
| 65 | # RemoveCharactersByPositionRequest.theLastNCharacters : Specify removing the last n characters from selected cells. , | ||
| 66 | # RemoveCharactersByPositionRequest.allCharactersBeforeText : Specify using targeted removal options to delete text that is located before certain characters. , | ||
| 67 | # RemoveCharactersByPositionRequest.allCharactersAfterText : Specify using targeted removal options to delete text that is located after certain characters. , | ||
| 68 | # RemoveCharactersByPositionRequest.caseSensitive : , | ||
| 69 | # RemoveCharactersByPositionRequest.worksheet : Specify the worksheet of spreadsheet. , | ||
| 70 | # RemoveCharactersByPositionRequest.range : Specify the worksheet range of spreadsheet. , | ||
| 71 | # RemoveCharactersByPositionRequest.outPath : (Optional) The folder path where the workbook is stored. The default is null. , | ||
| 72 | # RemoveCharactersByPositionRequest.outStorageName : Output file Storage Name. , | ||
| 73 | # RemoveCharactersByPositionRequest.region : The spreadsheet region setting. , | ||
| 74 | # RemoveCharactersByPositionRequest.password : The password for opening spreadsheet file. | ||
| 75 | |||
| 76 | { | ||
| 77 | my $params = { | ||
| 78 | 'client' =>{ | ||
| 79 | data_type => 'ApiClient', | ||
| 80 | description => 'API Client.', | ||
| 81 | required => '0', | ||
| 82 | } | ||
| 83 | }; | ||
| 84 | __PACKAGE__->method_documentation->{ 'remove_characters_by_position' } = { | ||
| 85 | summary => 'Deletes characters from every cell in the target range by position (first/last N, before/after a substring, or between two delimiters) while preserving formulas, formatting and data-validation.', | ||
| 86 | params => $params, | ||
| 87 | returns => 'string', | ||
| 88 | }; | ||
| 89 | } | ||
| 90 | |||
| 91 | sub run_http_request { | ||
| 92 | my ($self, %args) = @_; | ||
| 93 | |||
| 94 | my $client = $args{'client'}; | ||
| 95 | |||
| 96 | # parse inputs | ||
| 97 | my $_resource_path = 'v4.0/cells/content/remove/characters-by-position'; | ||
| 98 | |||
| 99 | my $_method = 'PUT'; | ||
| 100 | my $query_params = {}; | ||
| 101 | my $header_params = {}; | ||
| 102 | my $form_params = {}; | ||
| 103 | |||
| 104 | |||
| 105 | my $_header_accept = $client->select_header_accept('application/json'); | ||
| 106 | if ($_header_accept) { | ||
| 107 | $header_params->{'Accept'} = $_header_accept; | ||
| 108 | } | ||
| 109 | $header_params->{'Content-Type'} = $client->select_header_content_type('multipart/form-data'); | ||
| 110 | |||
| 111 | if(defined $self->the_first_n_characters){ | ||
| 112 | $query_params->{'theFirstNCharacters'} = $client->to_query_value($self->the_first_n_characters); | ||
| 113 | } | ||
| 114 | |||
| 115 | if(defined $self->the_last_n_characters){ | ||
| 116 | $query_params->{'theLastNCharacters'} = $client->to_query_value($self->the_last_n_characters); | ||
| 117 | } | ||
| 118 | |||
| 119 | if(defined $self->all_characters_before_text){ | ||
| 120 | $query_params->{'allCharactersBeforeText'} = $client->to_query_value($self->all_characters_before_text); | ||
| 121 | } | ||
| 122 | |||
| 123 | if(defined $self->all_characters_after_text){ | ||
| 124 | $query_params->{'allCharactersAfterText'} = $client->to_query_value($self->all_characters_after_text); | ||
| 125 | } | ||
| 126 | |||
| 127 | if(defined $self->case_sensitive){ | ||
| 128 | $query_params->{'caseSensitive'} = $client->to_query_value($self->case_sensitive); | ||
| 129 | } | ||
| 130 | |||
| 131 | if(defined $self->worksheet){ | ||
| 132 | $query_params->{'worksheet'} = $client->to_query_value($self->worksheet); | ||
| 133 | } | ||
| 134 | |||
| 135 | if(defined $self->range){ | ||
| 136 | $query_params->{'range'} = $client->to_query_value($self->range); | ||
| 137 | } | ||
| 138 | |||
| 139 | if(defined $self->out_path){ | ||
| 140 | $query_params->{'outPath'} = $client->to_query_value($self->out_path); | ||
| 141 | } | ||
| 142 | |||
| 143 | if(defined $self->out_storage_name){ | ||
| 144 | $query_params->{'outStorageName'} = $client->to_query_value($self->out_storage_name); | ||
| 145 | } | ||
| 146 | |||
| 147 | if(defined $self->region){ | ||
| 148 | $query_params->{'region'} = $client->to_query_value($self->region); | ||
| 149 | } | ||
| 150 | |||
| 151 | if(defined $self->password){ | ||
| 152 | $query_params->{'password'} = $client->to_query_value($self->password); | ||
| 153 | } | ||
| 154 | my $_body_data; | ||
| 155 | |||
| 156 | |||
| 157 | if (defined $self->spreadsheet) { | ||
| 158 | $form_params->{basename($self->spreadsheet)} = [$self->spreadsheet ,basename($self->spreadsheet),'application/octet-stream']; | ||
| 159 | } | ||
| 160 | |||
| 161 | |||
| 162 | # authentication setting, if any | ||
| 163 | my $auth_settings = [qw()]; | ||
| 164 | |||
| 165 | # make the API Call | ||
| 166 | my $response = $client->call_api($_resource_path, $_method, $query_params, $form_params, $header_params, $_body_data, $auth_settings); | ||
| 167 | return $response; | ||
| 168 | } | ||
| 169 | |||
| 170 | |||
| 171 | __PACKAGE__->method_documentation({ | ||
| 172 | 'spreadsheet' => { | ||
| 173 | datatype => 'string', | ||
| 174 | base_name => 'Spreadsheet', | ||
| 175 | description => 'Upload spreadsheet file.', | ||
| 176 | format => '', | ||
| 177 | read_only => '', | ||
| 178 | }, | ||
| 179 | 'the_first_n_characters' => { | ||
| 180 | datatype => 'int', | ||
| 181 | base_name => 'theFirstNCharacters', | ||
| 182 | description => 'Specify removing the first n characters from selected cells.', | ||
| 183 | format => '', | ||
| 184 | read_only => '', | ||
| 185 | }, | ||
| 186 | 'the_last_n_characters' => { | ||
| 187 | datatype => 'int', | ||
| 188 | base_name => 'theLastNCharacters', | ||
| 189 | description => 'Specify removing the last n characters from selected cells.', | ||
| 190 | format => '', | ||
| 191 | read_only => '', | ||
| 192 | }, | ||
| 193 | 'all_characters_before_text' => { | ||
| 194 | datatype => 'string', | ||
| 195 | base_name => 'allCharactersBeforeText', | ||
| 196 | description => 'Specify using targeted removal options to delete text that is located before certain characters.', | ||
| 197 | format => '', | ||
| 198 | read_only => '', | ||
| 199 | }, | ||
| 200 | 'all_characters_after_text' => { | ||
| 201 | datatype => 'string', | ||
| 202 | base_name => 'allCharactersAfterText', | ||
| 203 | description => 'Specify using targeted removal options to delete text that is located after certain characters.', | ||
| 204 | format => '', | ||
| 205 | read_only => '', | ||
| 206 | }, | ||
| 207 | 'case_sensitive' => { | ||
| 208 | datatype => 'string', | ||
| 209 | base_name => 'caseSensitive', | ||
| 210 | description => '', | ||
| 211 | format => '', | ||
| 212 | read_only => '', | ||
| 213 | }, | ||
| 214 | 'worksheet' => { | ||
| 215 | datatype => 'string', | ||
| 216 | base_name => 'worksheet', | ||
| 217 | description => 'Specify the worksheet of spreadsheet.', | ||
| 218 | format => '', | ||
| 219 | read_only => '', | ||
| 220 | }, | ||
| 221 | 'range' => { | ||
| 222 | datatype => 'string', | ||
| 223 | base_name => 'range', | ||
| 224 | description => 'Specify the worksheet range of spreadsheet.', | ||
| 225 | format => '', | ||
| 226 | read_only => '', | ||
| 227 | }, | ||
| 228 | 'out_path' => { | ||
| 229 | datatype => 'string', | ||
| 230 | base_name => 'outPath', | ||
| 231 | description => '(Optional) The folder path where the workbook is stored. The default is null.', | ||
| 232 | format => '', | ||
| 233 | read_only => '', | ||
| 234 | }, | ||
| 235 | 'out_storage_name' => { | ||
| 236 | datatype => 'string', | ||
| 237 | base_name => 'outStorageName', | ||
| 238 | description => 'Output file Storage Name.', | ||
| 239 | format => '', | ||
| 240 | read_only => '', | ||
| 241 | }, | ||
| 242 | 'region' => { | ||
| 243 | datatype => 'string', | ||
| 244 | base_name => 'region', | ||
| 245 | description => 'The spreadsheet region setting.', | ||
| 246 | format => '', | ||
| 247 | read_only => '', | ||
| 248 | }, | ||
| 249 | 'password' => { | ||
| 250 | datatype => 'string', | ||
| 251 | base_name => 'password', | ||
| 252 | description => 'The password for opening spreadsheet file.', | ||
| 253 | format => '', | ||
| 254 | read_only => '', | ||
| 255 | }, | ||
| 256 | }); | ||
| 257 | |||
| 258 | |||
| 259 | __PACKAGE__->attribute_map( { | ||
| 260 | 'spreadsheet' => 'Spreadsheet', | ||
| 261 | 'the_first_n_characters' => 'theFirstNCharacters', | ||
| 262 | 'the_last_n_characters' => 'theLastNCharacters', | ||
| 263 | 'all_characters_before_text' => 'allCharactersBeforeText', | ||
| 264 | 'all_characters_after_text' => 'allCharactersAfterText', | ||
| 265 | 'case_sensitive' => 'caseSensitive', | ||
| 266 | 'worksheet' => 'worksheet', | ||
| 267 | 'range' => 'range', | ||
| 268 | 'out_path' => 'outPath', | ||
| 269 | 'out_storage_name' => 'outStorageName', | ||
| 270 | 'region' => 'region', | ||
| 271 | 'password' => 'password' | ||
| 272 | } ); | ||
| 273 | |||
| 274 | __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); | ||
| 275 | |||
| 276 | |||
| 277 | 1; |