=begin comment

Web API Swagger specification

No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)

OpenAPI spec version: 1.0

Generated by: https://github.com/swagger-api/swagger-codegen.git

=end comment

=cut

#
# NOTE: This class is auto generated by the swagger code generator program. 
# Do not edit the class manually.
# Ref: https://github.com/swagger-api/swagger-codegen
#
package AsposeCellsCloud::CellsSaveAsApi;

require 5.6.0;
use strict;
use warnings;
use utf8; 
use Exporter;
use Carp qw( croak );
use Log::Any qw($log);

use AsposeCellsCloud::ApiClient;

use base "Class::Data::Inheritable";

__PACKAGE__->mk_classdata('method_documentation' => {});

sub new {
    my $class = shift;
    my $api_client;

    if ($_[0] && ref $_[0] && ref $_[0] eq 'AsposeCellsCloud::ApiClient' ) {
        $api_client = $_[0];
    } else {
        $api_client = AsposeCellsCloud::ApiClient->new(@_);
    }

    bless { api_client => $api_client }, $class;

}


#
# cells_save_as_post_document_save_as
#
# Convert document and save result to storage.
# 
# @param string $name The document name. (required)
# @param SaveOptions $save_options Save options. (optional)
# @param string $newfilename The new file name. (optional)
# @param boolean $is_auto_fit_rows Autofit rows. (optional, default to false)
# @param boolean $is_auto_fit_columns Autofit columns. (optional, default to false)
# @param string $folder The document folder. (optional)
# @param string $storage storage name. (optional)
{
    my $params = {
    'name' => {
        data_type => 'string',
        description => 'The document name.',
        required => '1',
    },
    'save_options' => {
        data_type => 'SaveOptions',
        description => 'Save options.',
        required => '0',
    },
    'newfilename' => {
        data_type => 'string',
        description => 'The new file name.',
        required => '0',
    },
    'is_auto_fit_rows' => {
        data_type => 'boolean',
        description => 'Autofit rows.',
        required => '0',
    },
    'is_auto_fit_columns' => {
        data_type => 'boolean',
        description => 'Autofit columns.',
        required => '0',
    },
    'folder' => {
        data_type => 'string',
        description => 'The document folder.',
        required => '0',
    },
    'storage' => {
        data_type => 'string',
        description => 'storage name.',
        required => '0',
    },
    };
    __PACKAGE__->method_documentation->{ 'cells_save_as_post_document_save_as' } = { 
    	summary => 'Convert document and save result to storage.',
        params => $params,
        returns => 'SaveResponse',
        };
}
# @return SaveResponse
#
sub cells_save_as_post_document_save_as {
    my ($self, %args) = @_;

    # verify the required parameter 'name' is set
    unless (exists $args{'name'}) {
      croak("Missing the required parameter 'name' when calling cells_save_as_post_document_save_as");
    }

    # parse inputs
    my $_resource_path = '/cells/{name}/SaveAs';

    my $_method = 'POST';
    my $query_params = {};
    my $header_params = {};
    my $form_params = {};

    # 'Accept' and 'Content-Type' header
    my $_header_accept = $self->{api_client}->select_header_accept('application/json');
    if ($_header_accept) {
        $header_params->{'Accept'} = $_header_accept;
    }
    $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');

    # query params
    if ( exists $args{'newfilename'}) {
        $query_params->{'newfilename'} = $self->{api_client}->to_query_value($args{'newfilename'});
    }

    # query params
    if ( exists $args{'is_auto_fit_rows'}) {
        $query_params->{'isAutoFitRows'} = $self->{api_client}->to_query_value($args{'is_auto_fit_rows'});
    }

    # query params
    if ( exists $args{'is_auto_fit_columns'}) {
        $query_params->{'isAutoFitColumns'} = $self->{api_client}->to_query_value($args{'is_auto_fit_columns'});
    }

    # query params
    if ( exists $args{'folder'}) {
        $query_params->{'folder'} = $self->{api_client}->to_query_value($args{'folder'});
    }

    # query params
    if ( exists $args{'storage'}) {
        $query_params->{'storage'} = $self->{api_client}->to_query_value($args{'storage'});
    }

    # path params
    if ( exists $args{'name'}) {
        my $_base_variable = "{" . "name" . "}";
        my $_base_value = $self->{api_client}->to_path_value($args{'name'});
        $_resource_path =~ s/$_base_variable/$_base_value/g;
    }

    my $_body_data;
    # body params
    if ( exists $args{'save_options'}) {
        $_body_data = $args{'save_options'};
    }

    # authentication setting, if any
    my $auth_settings = [qw()];

    # make the API Call
    my $response = $self->{api_client}->call_api($_resource_path, $_method,
                                           $query_params, $form_params,
                                           $header_params, $_body_data, $auth_settings);
    if (!$response) {
        return;
    }
    my $_response_object = $self->{api_client}->deserialize('SaveResponse', $response);
    return $_response_object;
}

1;
