| 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::PutWorksheetChartRequest; | ||
| 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 | # PutWorksheetChartRequest.name : The file name. , | ||
| 64 | # PutWorksheetChartRequest.sheetName : The worksheet name. , | ||
| 65 | # PutWorksheetChartRequest.chartType : Chart type, please refer property Type in chart resource. , | ||
| 66 | # PutWorksheetChartRequest.upperLeftRow : Upper-left row for the new chart. , | ||
| 67 | # PutWorksheetChartRequest.upperLeftColumn : Upper-left column for the new chart. , | ||
| 68 | # PutWorksheetChartRequest.lowerRightRow : Lower-left row for the new chart. , | ||
| 69 | # PutWorksheetChartRequest.lowerRightColumn : Lower-left column for the new chart. , | ||
| 70 | # PutWorksheetChartRequest.area : Specify the values from which to plot the data series. , | ||
| 71 | # PutWorksheetChartRequest.isVertical : Specify whether to plot the series from a range of cell values by row or by column. , | ||
| 72 | # PutWorksheetChartRequest.categoryData : Get or set the range of category axis values. It can be a range of cells (e.g., "D1:E10"). , | ||
| 73 | # PutWorksheetChartRequest.isAutoGetSerialName : Specify whether to auto-update the serial name. , | ||
| 74 | # PutWorksheetChartRequest.title : Specify the chart title name. , | ||
| 75 | # PutWorksheetChartRequest.folder : The folder where the file is situated. , | ||
| 76 | # PutWorksheetChartRequest.dataLabels : Represents the specified chart`s data label values display behavior. True to display the values, False to hide them. , | ||
| 77 | # PutWorksheetChartRequest.dataLabelsPosition : Represents data label position (Center/InsideBase/InsideEnd/OutsideEnd/Above/Below/Left/Right/BestFit/Moved). , | ||
| 78 | # PutWorksheetChartRequest.pivotTableSheet : The source is the data of the pivotTable. If PivotSource is not empty, the chart is a PivotChart. , | ||
| 79 | # PutWorksheetChartRequest.pivotTableName : The pivot table name. , | ||
| 80 | # PutWorksheetChartRequest.storageName : The storage name where the file is situated. | ||
| 81 | |||
| 82 | { | ||
| 83 | my $params = { | ||
| 84 | 'client' =>{ | ||
| 85 | data_type => 'ApiClient', | ||
| 86 | description => 'API Client.', | ||
| 87 | required => '0', | ||
| 88 | } | ||
| 89 | }; | ||
| 90 | __PACKAGE__->method_documentation->{ 'put_worksheet_chart' } = { | ||
| 91 | summary => 'Add a new chart in the worksheet.', | ||
| 92 | params => $params, | ||
| 93 | returns => 'CellsCloudResponse', | ||
| 94 | }; | ||
| 95 | } | ||
| 96 | |||
| 97 | sub run_http_request { | ||
| 98 | my ($self, %args) = @_; | ||
| 99 | |||
| 100 | my $client = $args{'client'}; | ||
| 101 | |||
| 102 | # parse inputs | ||
| 103 | my $_resource_path = 'v3.0/cells/{name}/worksheets/{sheetName}/charts'; | ||
| 104 | |||
| 105 | my $_method = 'PUT'; | ||
| 106 | my $query_params = {}; | ||
| 107 | my $header_params = {}; | ||
| 108 | my $form_params = {}; | ||
| 109 | |||
| 110 | |||
| 111 | my $_header_accept = $client->select_header_accept('application/json'); | ||
| 112 | if ($_header_accept) { | ||
| 113 | $header_params->{'Accept'} = $_header_accept; | ||
| 114 | } | ||
| 115 | $header_params->{'Content-Type'} = $client->select_header_content_type('application/json'); | ||
| 116 | if(defined $self->name){ | ||
| 117 | my $_base_variable = "{" . "name" . "}"; | ||
| 118 | my $_base_value = $client->to_path_value($self->name); | ||
| 119 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 120 | } | ||
| 121 | |||
| 122 | if(defined $self->sheet_name){ | ||
| 123 | my $_base_variable = "{" . "sheetName" . "}"; | ||
| 124 | my $_base_value = $client->to_path_value($self->sheet_name); | ||
| 125 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 126 | } | ||
| 127 | if(defined $self->chart_type){ | ||
| 128 | $query_params->{'chartType'} = $client->to_query_value($self->chart_type); | ||
| 129 | } | ||
| 130 | |||
| 131 | if(defined $self->upper_left_row){ | ||
| 132 | $query_params->{'upperLeftRow'} = $client->to_query_value($self->upper_left_row); | ||
| 133 | } | ||
| 134 | |||
| 135 | if(defined $self->upper_left_column){ | ||
| 136 | $query_params->{'upperLeftColumn'} = $client->to_query_value($self->upper_left_column); | ||
| 137 | } | ||
| 138 | |||
| 139 | if(defined $self->lower_right_row){ | ||
| 140 | $query_params->{'lowerRightRow'} = $client->to_query_value($self->lower_right_row); | ||
| 141 | } | ||
| 142 | |||
| 143 | if(defined $self->lower_right_column){ | ||
| 144 | $query_params->{'lowerRightColumn'} = $client->to_query_value($self->lower_right_column); | ||
| 145 | } | ||
| 146 | |||
| 147 | if(defined $self->area){ | ||
| 148 | $query_params->{'area'} = $client->to_query_value($self->area); | ||
| 149 | } | ||
| 150 | |||
| 151 | if(defined $self->is_vertical){ | ||
| 152 | $query_params->{'isVertical'} = $client->to_query_value($self->is_vertical); | ||
| 153 | } | ||
| 154 | |||
| 155 | if(defined $self->category_data){ | ||
| 156 | $query_params->{'categoryData'} = $client->to_query_value($self->category_data); | ||
| 157 | } | ||
| 158 | |||
| 159 | if(defined $self->is_auto_get_serial_name){ | ||
| 160 | $query_params->{'isAutoGetSerialName'} = $client->to_query_value($self->is_auto_get_serial_name); | ||
| 161 | } | ||
| 162 | |||
| 163 | if(defined $self->title){ | ||
| 164 | $query_params->{'title'} = $client->to_query_value($self->title); | ||
| 165 | } | ||
| 166 | |||
| 167 | if(defined $self->folder){ | ||
| 168 | $query_params->{'folder'} = $client->to_query_value($self->folder); | ||
| 169 | } | ||
| 170 | |||
| 171 | if(defined $self->data_labels){ | ||
| 172 | $query_params->{'dataLabels'} = $client->to_query_value($self->data_labels); | ||
| 173 | } | ||
| 174 | |||
| 175 | if(defined $self->data_labels_position){ | ||
| 176 | $query_params->{'dataLabelsPosition'} = $client->to_query_value($self->data_labels_position); | ||
| 177 | } | ||
| 178 | |||
| 179 | if(defined $self->pivot_table_sheet){ | ||
| 180 | $query_params->{'pivotTableSheet'} = $client->to_query_value($self->pivot_table_sheet); | ||
| 181 | } | ||
| 182 | |||
| 183 | if(defined $self->pivot_table_name){ | ||
| 184 | $query_params->{'pivotTableName'} = $client->to_query_value($self->pivot_table_name); | ||
| 185 | } | ||
| 186 | |||
| 187 | if(defined $self->storage_name){ | ||
| 188 | $query_params->{'storageName'} = $client->to_query_value($self->storage_name); | ||
| 189 | } | ||
| 190 | my $_body_data; | ||
| 191 | |||
| 192 | |||
| 193 | |||
| 194 | # authentication setting, if any | ||
| 195 | my $auth_settings = [qw()]; | ||
| 196 | |||
| 197 | # make the API Call | ||
| 198 | my $response = $client->call_api($_resource_path, $_method, $query_params, $form_params, $header_params, $_body_data, $auth_settings); | ||
| 199 | return $response; | ||
| 200 | } | ||
| 201 | |||
| 202 | |||
| 203 | __PACKAGE__->method_documentation({ | ||
| 204 | 'name' => { | ||
| 205 | datatype => 'string', | ||
| 206 | base_name => 'name', | ||
| 207 | description => 'The file name.', | ||
| 208 | format => '', | ||
| 209 | read_only => '', | ||
| 210 | }, | ||
| 211 | 'sheet_name' => { | ||
| 212 | datatype => 'string', | ||
| 213 | base_name => 'sheetName', | ||
| 214 | description => 'The worksheet name.', | ||
| 215 | format => '', | ||
| 216 | read_only => '', | ||
| 217 | }, | ||
| 218 | 'chart_type' => { | ||
| 219 | datatype => 'string', | ||
| 220 | base_name => 'chartType', | ||
| 221 | description => 'Chart type, please refer property Type in chart resource.', | ||
| 222 | format => '', | ||
| 223 | read_only => '', | ||
| 224 | }, | ||
| 225 | 'upper_left_row' => { | ||
| 226 | datatype => 'int', | ||
| 227 | base_name => 'upperLeftRow', | ||
| 228 | description => 'Upper-left row for the new chart.', | ||
| 229 | format => '', | ||
| 230 | read_only => '', | ||
| 231 | }, | ||
| 232 | 'upper_left_column' => { | ||
| 233 | datatype => 'int', | ||
| 234 | base_name => 'upperLeftColumn', | ||
| 235 | description => 'Upper-left column for the new chart.', | ||
| 236 | format => '', | ||
| 237 | read_only => '', | ||
| 238 | }, | ||
| 239 | 'lower_right_row' => { | ||
| 240 | datatype => 'int', | ||
| 241 | base_name => 'lowerRightRow', | ||
| 242 | description => 'Lower-left row for the new chart.', | ||
| 243 | format => '', | ||
| 244 | read_only => '', | ||
| 245 | }, | ||
| 246 | 'lower_right_column' => { | ||
| 247 | datatype => 'int', | ||
| 248 | base_name => 'lowerRightColumn', | ||
| 249 | description => 'Lower-left column for the new chart.', | ||
| 250 | format => '', | ||
| 251 | read_only => '', | ||
| 252 | }, | ||
| 253 | 'area' => { | ||
| 254 | datatype => 'string', | ||
| 255 | base_name => 'area', | ||
| 256 | description => 'Specify the values from which to plot the data series.', | ||
| 257 | format => '', | ||
| 258 | read_only => '', | ||
| 259 | }, | ||
| 260 | 'is_vertical' => { | ||
| 261 | datatype => 'string', | ||
| 262 | base_name => 'isVertical', | ||
| 263 | description => 'Specify whether to plot the series from a range of cell values by row or by column. ', | ||
| 264 | format => '', | ||
| 265 | read_only => '', | ||
| 266 | }, | ||
| 267 | 'category_data' => { | ||
| 268 | datatype => 'string', | ||
| 269 | base_name => 'categoryData', | ||
| 270 | description => 'Get or set the range of category axis values. It can be a range of cells (e.g., "D1:E10").', | ||
| 271 | format => '', | ||
| 272 | read_only => '', | ||
| 273 | }, | ||
| 274 | 'is_auto_get_serial_name' => { | ||
| 275 | datatype => 'string', | ||
| 276 | base_name => 'isAutoGetSerialName', | ||
| 277 | description => 'Specify whether to auto-update the serial name.', | ||
| 278 | format => '', | ||
| 279 | read_only => '', | ||
| 280 | }, | ||
| 281 | 'title' => { | ||
| 282 | datatype => 'string', | ||
| 283 | base_name => 'title', | ||
| 284 | description => 'Specify the chart title name.', | ||
| 285 | format => '', | ||
| 286 | read_only => '', | ||
| 287 | }, | ||
| 288 | 'folder' => { | ||
| 289 | datatype => 'string', | ||
| 290 | base_name => 'folder', | ||
| 291 | description => 'The folder where the file is situated.', | ||
| 292 | format => '', | ||
| 293 | read_only => '', | ||
| 294 | }, | ||
| 295 | 'data_labels' => { | ||
| 296 | datatype => 'string', | ||
| 297 | base_name => 'dataLabels', | ||
| 298 | description => 'Represents the specified chart`s data label values display behavior. True to display the values, False to hide them.', | ||
| 299 | format => '', | ||
| 300 | read_only => '', | ||
| 301 | }, | ||
| 302 | 'data_labels_position' => { | ||
| 303 | datatype => 'string', | ||
| 304 | base_name => 'dataLabelsPosition', | ||
| 305 | description => 'Represents data label position (Center/InsideBase/InsideEnd/OutsideEnd/Above/Below/Left/Right/BestFit/Moved).', | ||
| 306 | format => '', | ||
| 307 | read_only => '', | ||
| 308 | }, | ||
| 309 | 'pivot_table_sheet' => { | ||
| 310 | datatype => 'string', | ||
| 311 | base_name => 'pivotTableSheet', | ||
| 312 | description => 'The source is the data of the pivotTable. If PivotSource is not empty, the chart is a PivotChart.', | ||
| 313 | format => '', | ||
| 314 | read_only => '', | ||
| 315 | }, | ||
| 316 | 'pivot_table_name' => { | ||
| 317 | datatype => 'string', | ||
| 318 | base_name => 'pivotTableName', | ||
| 319 | description => 'The pivot table name.', | ||
| 320 | format => '', | ||
| 321 | read_only => '', | ||
| 322 | }, | ||
| 323 | 'storage_name' => { | ||
| 324 | datatype => 'string', | ||
| 325 | base_name => 'storageName', | ||
| 326 | description => 'The storage name where the file is situated.', | ||
| 327 | format => '', | ||
| 328 | read_only => '', | ||
| 329 | }, | ||
| 330 | }); | ||
| 331 | |||
| 332 | |||
| 333 | __PACKAGE__->attribute_map( { | ||
| 334 | 'name' => 'name', | ||
| 335 | 'sheet_name' => 'sheetName', | ||
| 336 | 'chart_type' => 'chartType', | ||
| 337 | 'upper_left_row' => 'upperLeftRow', | ||
| 338 | 'upper_left_column' => 'upperLeftColumn', | ||
| 339 | 'lower_right_row' => 'lowerRightRow', | ||
| 340 | 'lower_right_column' => 'lowerRightColumn', | ||
| 341 | 'area' => 'area', | ||
| 342 | 'is_vertical' => 'isVertical', | ||
| 343 | 'category_data' => 'categoryData', | ||
| 344 | 'is_auto_get_serial_name' => 'isAutoGetSerialName', | ||
| 345 | 'title' => 'title', | ||
| 346 | 'folder' => 'folder', | ||
| 347 | 'data_labels' => 'dataLabels', | ||
| 348 | 'data_labels_position' => 'dataLabelsPosition', | ||
| 349 | 'pivot_table_sheet' => 'pivotTableSheet', | ||
| 350 | 'pivot_table_name' => 'pivotTableName', | ||
| 351 | 'storage_name' => 'storageName' | ||
| 352 | } ); | ||
| 353 | |||
| 354 | __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); | ||
| 355 | |||
| 356 | |||
| 357 | 1; |