| 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::PostCopyWorksheetRequest; | ||
| 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 | # PostCopyWorksheetRequest.name : The file name. , | ||
| 64 | # PostCopyWorksheetRequest.sheetName : The worksheet name. , | ||
| 65 | # PostCopyWorksheetRequest.sourceSheet : Source worksheet. , | ||
| 66 | # PostCopyWorksheetRequest.options : Represents the copy options. , | ||
| 67 | # PostCopyWorksheetRequest.sourceWorkbook : source Workbook. , | ||
| 68 | # PostCopyWorksheetRequest.sourceFolder : Original workbook folder. , | ||
| 69 | # PostCopyWorksheetRequest.folder : The folder where the file is situated. , | ||
| 70 | # PostCopyWorksheetRequest.storageName : The storage name where the file is situated. | ||
| 71 | |||
| 72 | { | ||
| 73 | my $params = { | ||
| 74 | 'client' =>{ | ||
| 75 | data_type => 'ApiClient', | ||
| 76 | description => 'API Client.', | ||
| 77 | required => '0', | ||
| 78 | } | ||
| 79 | }; | ||
| 80 | __PACKAGE__->method_documentation->{ 'post_copy_worksheet' } = { | ||
| 81 | summary => 'Copy contents and formats from another worksheet.', | ||
| 82 | params => $params, | ||
| 83 | returns => 'CellsCloudResponse', | ||
| 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 = 'v3.0/cells/{name}/worksheets/{sheetName}/copy'; | ||
| 94 | |||
| 95 | my $_method = 'POST'; | ||
| 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('application/json'); | ||
| 106 | if(defined $self->name){ | ||
| 107 | my $_base_variable = "{" . "name" . "}"; | ||
| 108 | my $_base_value = $client->to_path_value($self->name); | ||
| 109 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 110 | } | ||
| 111 | |||
| 112 | if(defined $self->sheet_name){ | ||
| 113 | my $_base_variable = "{" . "sheetName" . "}"; | ||
| 114 | my $_base_value = $client->to_path_value($self->sheet_name); | ||
| 115 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 116 | } | ||
| 117 | if(defined $self->source_sheet){ | ||
| 118 | $query_params->{'sourceSheet'} = $client->to_query_value($self->source_sheet); | ||
| 119 | } | ||
| 120 | |||
| 121 | if(defined $self->source_workbook){ | ||
| 122 | $query_params->{'sourceWorkbook'} = $client->to_query_value($self->source_workbook); | ||
| 123 | } | ||
| 124 | |||
| 125 | if(defined $self->source_folder){ | ||
| 126 | $query_params->{'sourceFolder'} = $client->to_query_value($self->source_folder); | ||
| 127 | } | ||
| 128 | |||
| 129 | if(defined $self->folder){ | ||
| 130 | $query_params->{'folder'} = $client->to_query_value($self->folder); | ||
| 131 | } | ||
| 132 | |||
| 133 | if(defined $self->storage_name){ | ||
| 134 | $query_params->{'storageName'} = $client->to_query_value($self->storage_name); | ||
| 135 | } | ||
| 136 | my $_body_data; | ||
| 137 | |||
| 138 | |||
| 139 | # body params | ||
| 140 | if (defined $self->options) { | ||
| 141 | $_body_data = JSON->new->convert_blessed->encode( $self->options); | ||
| 142 | } | ||
| 143 | |||
| 144 | |||
| 145 | |||
| 146 | # authentication setting, if any | ||
| 147 | my $auth_settings = [qw()]; | ||
| 148 | |||
| 149 | # make the API Call | ||
| 150 | my $response = $client->call_api($_resource_path, $_method, $query_params, $form_params, $header_params, $_body_data, $auth_settings); | ||
| 151 | return $response; | ||
| 152 | } | ||
| 153 | |||
| 154 | |||
| 155 | __PACKAGE__->method_documentation({ | ||
| 156 | 'name' => { | ||
| 157 | datatype => 'string', | ||
| 158 | base_name => 'name', | ||
| 159 | description => 'The file name.', | ||
| 160 | format => '', | ||
| 161 | read_only => '', | ||
| 162 | }, | ||
| 163 | 'sheet_name' => { | ||
| 164 | datatype => 'string', | ||
| 165 | base_name => 'sheetName', | ||
| 166 | description => 'The worksheet name.', | ||
| 167 | format => '', | ||
| 168 | read_only => '', | ||
| 169 | }, | ||
| 170 | 'source_sheet' => { | ||
| 171 | datatype => 'string', | ||
| 172 | base_name => 'sourceSheet', | ||
| 173 | description => 'Source worksheet.', | ||
| 174 | format => '', | ||
| 175 | read_only => '', | ||
| 176 | }, | ||
| 177 | 'options' => { | ||
| 178 | datatype => 'CopyOptions', | ||
| 179 | base_name => 'options', | ||
| 180 | description => 'Represents the copy options.', | ||
| 181 | format => '', | ||
| 182 | read_only => '', | ||
| 183 | }, | ||
| 184 | 'source_workbook' => { | ||
| 185 | datatype => 'string', | ||
| 186 | base_name => 'sourceWorkbook', | ||
| 187 | description => 'source Workbook.', | ||
| 188 | format => '', | ||
| 189 | read_only => '', | ||
| 190 | }, | ||
| 191 | 'source_folder' => { | ||
| 192 | datatype => 'string', | ||
| 193 | base_name => 'sourceFolder', | ||
| 194 | description => 'Original workbook folder.', | ||
| 195 | format => '', | ||
| 196 | read_only => '', | ||
| 197 | }, | ||
| 198 | 'folder' => { | ||
| 199 | datatype => 'string', | ||
| 200 | base_name => 'folder', | ||
| 201 | description => 'The folder where the file is situated.', | ||
| 202 | format => '', | ||
| 203 | read_only => '', | ||
| 204 | }, | ||
| 205 | 'storage_name' => { | ||
| 206 | datatype => 'string', | ||
| 207 | base_name => 'storageName', | ||
| 208 | description => 'The storage name where the file is situated.', | ||
| 209 | format => '', | ||
| 210 | read_only => '', | ||
| 211 | }, | ||
| 212 | }); | ||
| 213 | |||
| 214 | |||
| 215 | __PACKAGE__->attribute_map( { | ||
| 216 | 'name' => 'name', | ||
| 217 | 'sheet_name' => 'sheetName', | ||
| 218 | 'source_sheet' => 'sourceSheet', | ||
| 219 | 'options' => 'options', | ||
| 220 | 'source_workbook' => 'sourceWorkbook', | ||
| 221 | 'source_folder' => 'sourceFolder', | ||
| 222 | 'folder' => 'folder', | ||
| 223 | 'storage_name' => 'storageName' | ||
| 224 | } ); | ||
| 225 | |||
| 226 | __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); | ||
| 227 | |||
| 228 | |||
| 229 | 1; |