Request/PostProtectRequest.pm untested

filter: Statementstmt 0.0% 0 / 82 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 14 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 106 CC 5 SCAR 22.8
CC
5
Cov
0%
run_http_request
30.0
new
2.0
BEGIN
2.0
CRAP 9.8
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::PostProtectRequest;
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 # PostProtectRequest.File : File to upload ,
64 # PostProtectRequest.protectWorkbookRequest : ,
65 # PostProtectRequest.password : The password needed to open an Excel file.
66
67 {
68 my $params = {
69 'client' =>{
70 data_type => 'ApiClient',
71 description => 'API Client.',
72 required => '0',
73 }
74 };
75 __PACKAGE__->method_documentation->{ 'post_protect' } = {
76 summary => 'Excel files encryption.',
77 params => $params,
78 returns => 'FilesResult',
79 };
80 }
81
82 sub run_http_request {
83 my ($self, %args) = @_;
84
85 my $client = $args{'client'};
86
87 # parse inputs
88 my $_resource_path = 'v3.0/cells/protect';
89
90 my $_method = 'POST';
91 my $query_params = {};
92 my $header_params = {};
93 my $form_params = {};
94
95
96 my $_header_accept = $client->select_header_accept('application/json');
97 if ($_header_accept) {
98 $header_params->{'Accept'} = $_header_accept;
99 }
100 $header_params->{'Content-Type'} = $client->select_header_content_type('multipart/form-data');
101
102 if(defined $self->password){
103 $query_params->{'password'} = $client->to_query_value($self->password);
104 }
105 my $_body_data;
106
107
108 # body params
109 if (defined $self->protect_workbook_request) {
110 $_body_data = JSON->new->convert_blessed->encode( $self->protect_workbook_request);
111 $form_params->{'protectWorkbookRequest'} = $_body_data ;
112 }
113
114 if (defined $self->file) {
115 $form_params->{basename($self->file)} = [$self->file ,basename($self->file),'application/octet-stream'];
116 }
117
118
119 # authentication setting, if any
120 my $auth_settings = [qw()];
121
122 # make the API Call
123 my $response = $client->call_api($_resource_path, $_method, $query_params, $form_params, $header_params, $_body_data, $auth_settings);
124 return $response;
125 }
126
127
128 __PACKAGE__->method_documentation({
129 'file' => {
130 datatype => 'string',
131 base_name => 'File',
132 description => 'File to upload',
133 format => '',
134 read_only => '',
135 },
136 'protect_workbook_request' => {
137 datatype => 'ProtectWorkbookRequest',
138 base_name => 'protectWorkbookRequest',
139 description => '',
140 format => '',
141 read_only => '',
142 },
143 'password' => {
144 datatype => 'string',
145 base_name => 'password',
146 description => 'The password needed to open an Excel file.',
147 format => '',
148 read_only => '',
149 },
150 });
151
152
153 __PACKAGE__->attribute_map( {
154 'file' => 'File',
155 'protect_workbook_request' => 'protectWorkbookRequest',
156 'password' => 'password'
157 } );
158
159 __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
160
161
162 1;