| 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::ConvertTableToPdfRequest; | ||
| 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 | # ConvertTableToPdfRequest.Spreadsheet : Upload spreadsheet file. , | ||
| 64 | # ConvertTableToPdfRequest.worksheet : worksheet name of spreadsheet. , | ||
| 65 | # ConvertTableToPdfRequest.tableName : table name , | ||
| 66 | # ConvertTableToPdfRequest.outPath : (Optional) The folder path where the workbook is stored. The default is null. , | ||
| 67 | # ConvertTableToPdfRequest.outStorageName : Output file Storage Name. , | ||
| 68 | # ConvertTableToPdfRequest.fontsLocation : Use Custom fonts. , | ||
| 69 | # ConvertTableToPdfRequest.region : The spreadsheet region setting. , | ||
| 70 | # ConvertTableToPdfRequest.password : The password for opening spreadsheet file. | ||
| 71 | |||
| 72 | { | ||
| 73 | my $params = { | ||
| 74 | 'client' =>{ | ||
| 75 | data_type => 'ApiClient', | ||
| 76 | description => 'API Client.', | ||
| 77 | required => '0', | ||
| 78 | } | ||
| 79 | }; | ||
| 80 | __PACKAGE__->method_documentation->{ 'convert_table_to_pdf' } = { | ||
| 81 | summary => 'Converts a table of spreadsheet on a local drive to the pdf file.', | ||
| 82 | params => $params, | ||
| 83 | returns => 'string', | ||
| 84 | }; | ||
| 85 | } | ||
| 86 | |||
| 87 | sub run_http_request { | ||
| 88 | my ($self, %args) = @_; | ||
| 89 | |||
| 90 | my $client = $args{'client'}; | ||
| 91 | |||
| 92 | # parse inputs | ||
| 93 | my $_resource_path = 'v4.0/cells/convert/table/pdf'; | ||
| 94 | |||
| 95 | my $_method = 'PUT'; | ||
| 96 | my $query_params = {}; | ||
| 97 | my $header_params = {}; | ||
| 98 | my $form_params = {}; | ||
| 99 | |||
| 100 | |||
| 101 | my $_header_accept = $client->select_header_accept('application/json'); | ||
| 102 | if ($_header_accept) { | ||
| 103 | $header_params->{'Accept'} = $_header_accept; | ||
| 104 | } | ||
| 105 | $header_params->{'Content-Type'} = $client->select_header_content_type('multipart/form-data'); | ||
| 106 | |||
| 107 | if(defined $self->worksheet){ | ||
| 108 | $query_params->{'worksheet'} = $client->to_query_value($self->worksheet); | ||
| 109 | } | ||
| 110 | |||
| 111 | if(defined $self->table_name){ | ||
| 112 | $query_params->{'tableName'} = $client->to_query_value($self->table_name); | ||
| 113 | } | ||
| 114 | |||
| 115 | if(defined $self->out_path){ | ||
| 116 | $query_params->{'outPath'} = $client->to_query_value($self->out_path); | ||
| 117 | } | ||
| 118 | |||
| 119 | if(defined $self->out_storage_name){ | ||
| 120 | $query_params->{'outStorageName'} = $client->to_query_value($self->out_storage_name); | ||
| 121 | } | ||
| 122 | |||
| 123 | if(defined $self->fonts_location){ | ||
| 124 | $query_params->{'fontsLocation'} = $client->to_query_value($self->fonts_location); | ||
| 125 | } | ||
| 126 | |||
| 127 | if(defined $self->region){ | ||
| 128 | $query_params->{'region'} = $client->to_query_value($self->region); | ||
| 129 | } | ||
| 130 | |||
| 131 | if(defined $self->password){ | ||
| 132 | $query_params->{'password'} = $client->to_query_value($self->password); | ||
| 133 | } | ||
| 134 | my $_body_data; | ||
| 135 | |||
| 136 | |||
| 137 | if (defined $self->spreadsheet) { | ||
| 138 | $form_params->{basename($self->spreadsheet)} = [$self->spreadsheet ,basename($self->spreadsheet),'application/octet-stream']; | ||
| 139 | } | ||
| 140 | |||
| 141 | |||
| 142 | # authentication setting, if any | ||
| 143 | my $auth_settings = [qw()]; | ||
| 144 | |||
| 145 | # make the API Call | ||
| 146 | my $response = $client->call_api($_resource_path, $_method, $query_params, $form_params, $header_params, $_body_data, $auth_settings); | ||
| 147 | return $response; | ||
| 148 | } | ||
| 149 | |||
| 150 | |||
| 151 | __PACKAGE__->method_documentation({ | ||
| 152 | 'spreadsheet' => { | ||
| 153 | datatype => 'string', | ||
| 154 | base_name => 'Spreadsheet', | ||
| 155 | description => 'Upload spreadsheet file.', | ||
| 156 | format => '', | ||
| 157 | read_only => '', | ||
| 158 | }, | ||
| 159 | 'worksheet' => { | ||
| 160 | datatype => 'string', | ||
| 161 | base_name => 'worksheet', | ||
| 162 | description => 'worksheet name of spreadsheet.', | ||
| 163 | format => '', | ||
| 164 | read_only => '', | ||
| 165 | }, | ||
| 166 | 'table_name' => { | ||
| 167 | datatype => 'string', | ||
| 168 | base_name => 'tableName', | ||
| 169 | description => 'table name', | ||
| 170 | format => '', | ||
| 171 | read_only => '', | ||
| 172 | }, | ||
| 173 | 'out_path' => { | ||
| 174 | datatype => 'string', | ||
| 175 | base_name => 'outPath', | ||
| 176 | description => '(Optional) The folder path where the workbook is stored. The default is null.', | ||
| 177 | format => '', | ||
| 178 | read_only => '', | ||
| 179 | }, | ||
| 180 | 'out_storage_name' => { | ||
| 181 | datatype => 'string', | ||
| 182 | base_name => 'outStorageName', | ||
| 183 | description => 'Output file Storage Name.', | ||
| 184 | format => '', | ||
| 185 | read_only => '', | ||
| 186 | }, | ||
| 187 | 'fonts_location' => { | ||
| 188 | datatype => 'string', | ||
| 189 | base_name => 'fontsLocation', | ||
| 190 | description => 'Use Custom fonts.', | ||
| 191 | format => '', | ||
| 192 | read_only => '', | ||
| 193 | }, | ||
| 194 | 'region' => { | ||
| 195 | datatype => 'string', | ||
| 196 | base_name => 'region', | ||
| 197 | description => 'The spreadsheet region setting.', | ||
| 198 | format => '', | ||
| 199 | read_only => '', | ||
| 200 | }, | ||
| 201 | 'password' => { | ||
| 202 | datatype => 'string', | ||
| 203 | base_name => 'password', | ||
| 204 | description => 'The password for opening spreadsheet file.', | ||
| 205 | format => '', | ||
| 206 | read_only => '', | ||
| 207 | }, | ||
| 208 | }); | ||
| 209 | |||
| 210 | |||
| 211 | __PACKAGE__->attribute_map( { | ||
| 212 | 'spreadsheet' => 'Spreadsheet', | ||
| 213 | 'worksheet' => 'worksheet', | ||
| 214 | 'table_name' => 'tableName', | ||
| 215 | 'out_path' => 'outPath', | ||
| 216 | 'out_storage_name' => 'outStorageName', | ||
| 217 | 'fonts_location' => 'fontsLocation', | ||
| 218 | 'region' => 'region', | ||
| 219 | 'password' => 'password' | ||
| 220 | } ); | ||
| 221 | |||
| 222 | __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); | ||
| 223 | |||
| 224 | |||
| 225 | 1; |