« Request/SplitSpreadsheetRequest.pm
↑ Summary
Request/AcceptAllRevisionsInRemoteSpreadsheetRequest.pm »
| 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::SwapRangeRequest; | ||
| 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 | # SwapRangeRequest.Spreadsheet : Upload spreadsheet file. , | ||
| 64 | # SwapRangeRequest.worksheet1 : Specify the worksheet that is the source of the exchange data area. , | ||
| 65 | # SwapRangeRequest.range1 : Specify exchange data source. , | ||
| 66 | # SwapRangeRequest.worksheet2 : Specify the worksheet that is the target of the exchange data area. , | ||
| 67 | # SwapRangeRequest.range2 : Specify exchange data target. , | ||
| 68 | # SwapRangeRequest.outPath : (Optional) The folder path where the workbook is stored. The default is null. , | ||
| 69 | # SwapRangeRequest.outStorageName : Output file Storage Name. , | ||
| 70 | # SwapRangeRequest.region : The spreadsheet region setting. , | ||
| 71 | # SwapRangeRequest.password : The password for opening spreadsheet file. | ||
| 72 | |||
| 73 | { | ||
| 74 | my $params = { | ||
| 75 | 'client' =>{ | ||
| 76 | data_type => 'ApiClient', | ||
| 77 | description => 'API Client.', | ||
| 78 | required => '0', | ||
| 79 | } | ||
| 80 | }; | ||
| 81 | __PACKAGE__->method_documentation->{ 'swap_range' } = { | ||
| 82 | summary => 'The Swap Ranges for Excel API provides a powerful tool to move any two columns, rows, ranges, or individual cells within an Excel file. This API allows users to re-arrange their tables quickly and efficiently, ensuring that the original data formatting is preserved and all existing formulas continue to function correctly. By leveraging this API, users can streamline their data manipulation tasks and maintain the integrity of their spreadsheets.', | ||
| 83 | params => $params, | ||
| 84 | returns => 'string', | ||
| 85 | }; | ||
| 86 | } | ||
| 87 | |||
| 88 | sub run_http_request { | ||
| 89 | my ($self, %args) = @_; | ||
| 90 | |||
| 91 | my $client = $args{'client'}; | ||
| 92 | |||
| 93 | # parse inputs | ||
| 94 | my $_resource_path = 'v4.0/cells/swap/range'; | ||
| 95 | |||
| 96 | my $_method = 'PUT'; | ||
| 97 | my $query_params = {}; | ||
| 98 | my $header_params = {}; | ||
| 99 | my $form_params = {}; | ||
| 100 | |||
| 101 | |||
| 102 | my $_header_accept = $client->select_header_accept('application/json'); | ||
| 103 | if ($_header_accept) { | ||
| 104 | $header_params->{'Accept'} = $_header_accept; | ||
| 105 | } | ||
| 106 | $header_params->{'Content-Type'} = $client->select_header_content_type('multipart/form-data'); | ||
| 107 | |||
| 108 | if(defined $self->worksheet1){ | ||
| 109 | $query_params->{'worksheet1'} = $client->to_query_value($self->worksheet1); | ||
| 110 | } | ||
| 111 | |||
| 112 | if(defined $self->range1){ | ||
| 113 | $query_params->{'range1'} = $client->to_query_value($self->range1); | ||
| 114 | } | ||
| 115 | |||
| 116 | if(defined $self->worksheet2){ | ||
| 117 | $query_params->{'worksheet2'} = $client->to_query_value($self->worksheet2); | ||
| 118 | } | ||
| 119 | |||
| 120 | if(defined $self->range2){ | ||
| 121 | $query_params->{'range2'} = $client->to_query_value($self->range2); | ||
| 122 | } | ||
| 123 | |||
| 124 | if(defined $self->out_path){ | ||
| 125 | $query_params->{'outPath'} = $client->to_query_value($self->out_path); | ||
| 126 | } | ||
| 127 | |||
| 128 | if(defined $self->out_storage_name){ | ||
| 129 | $query_params->{'outStorageName'} = $client->to_query_value($self->out_storage_name); | ||
| 130 | } | ||
| 131 | |||
| 132 | if(defined $self->region){ | ||
| 133 | $query_params->{'region'} = $client->to_query_value($self->region); | ||
| 134 | } | ||
| 135 | |||
| 136 | if(defined $self->password){ | ||
| 137 | $query_params->{'password'} = $client->to_query_value($self->password); | ||
| 138 | } | ||
| 139 | my $_body_data; | ||
| 140 | |||
| 141 | |||
| 142 | if (defined $self->spreadsheet) { | ||
| 143 | $form_params->{basename($self->spreadsheet)} = [$self->spreadsheet ,basename($self->spreadsheet),'application/octet-stream']; | ||
| 144 | } | ||
| 145 | |||
| 146 | |||
| 147 | # authentication setting, if any | ||
| 148 | my $auth_settings = [qw()]; | ||
| 149 | |||
| 150 | # make the API Call | ||
| 151 | my $response = $client->call_api($_resource_path, $_method, $query_params, $form_params, $header_params, $_body_data, $auth_settings); | ||
| 152 | return $response; | ||
| 153 | } | ||
| 154 | |||
| 155 | |||
| 156 | __PACKAGE__->method_documentation({ | ||
| 157 | 'spreadsheet' => { | ||
| 158 | datatype => 'string', | ||
| 159 | base_name => 'Spreadsheet', | ||
| 160 | description => 'Upload spreadsheet file.', | ||
| 161 | format => '', | ||
| 162 | read_only => '', | ||
| 163 | }, | ||
| 164 | 'worksheet1' => { | ||
| 165 | datatype => 'string', | ||
| 166 | base_name => 'worksheet1', | ||
| 167 | description => 'Specify the worksheet that is the source of the exchange data area.', | ||
| 168 | format => '', | ||
| 169 | read_only => '', | ||
| 170 | }, | ||
| 171 | 'range1' => { | ||
| 172 | datatype => 'string', | ||
| 173 | base_name => 'range1', | ||
| 174 | description => 'Specify exchange data source.', | ||
| 175 | format => '', | ||
| 176 | read_only => '', | ||
| 177 | }, | ||
| 178 | 'worksheet2' => { | ||
| 179 | datatype => 'string', | ||
| 180 | base_name => 'worksheet2', | ||
| 181 | description => 'Specify the worksheet that is the target of the exchange data area.', | ||
| 182 | format => '', | ||
| 183 | read_only => '', | ||
| 184 | }, | ||
| 185 | 'range2' => { | ||
| 186 | datatype => 'string', | ||
| 187 | base_name => 'range2', | ||
| 188 | description => 'Specify exchange data target.', | ||
| 189 | format => '', | ||
| 190 | read_only => '', | ||
| 191 | }, | ||
| 192 | 'out_path' => { | ||
| 193 | datatype => 'string', | ||
| 194 | base_name => 'outPath', | ||
| 195 | description => '(Optional) The folder path where the workbook is stored. The default is null.', | ||
| 196 | format => '', | ||
| 197 | read_only => '', | ||
| 198 | }, | ||
| 199 | 'out_storage_name' => { | ||
| 200 | datatype => 'string', | ||
| 201 | base_name => 'outStorageName', | ||
| 202 | description => 'Output file Storage Name.', | ||
| 203 | format => '', | ||
| 204 | read_only => '', | ||
| 205 | }, | ||
| 206 | 'region' => { | ||
| 207 | datatype => 'string', | ||
| 208 | base_name => 'region', | ||
| 209 | description => 'The spreadsheet region setting.', | ||
| 210 | format => '', | ||
| 211 | read_only => '', | ||
| 212 | }, | ||
| 213 | 'password' => { | ||
| 214 | datatype => 'string', | ||
| 215 | base_name => 'password', | ||
| 216 | description => 'The password for opening spreadsheet file.', | ||
| 217 | format => '', | ||
| 218 | read_only => '', | ||
| 219 | }, | ||
| 220 | }); | ||
| 221 | |||
| 222 | |||
| 223 | __PACKAGE__->attribute_map( { | ||
| 224 | 'spreadsheet' => 'Spreadsheet', | ||
| 225 | 'worksheet1' => 'worksheet1', | ||
| 226 | 'range1' => 'range1', | ||
| 227 | 'worksheet2' => 'worksheet2', | ||
| 228 | 'range2' => 'range2', | ||
| 229 | 'out_path' => 'outPath', | ||
| 230 | 'out_storage_name' => 'outStorageName', | ||
| 231 | 'region' => 'region', | ||
| 232 | 'password' => 'password' | ||
| 233 | } ); | ||
| 234 | |||
| 235 | __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); | ||
| 236 | |||
| 237 | |||
| 238 | 1; |