AsposeDiagramCloud-DiagramApi

 view release on metacpan or  search on metacpan

lib/AsposeDiagramCloud/DiagramApi.pm  view on Meta::CPAN

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 AsposeDiagramCloud::DiagramApi;

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



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 'AsposeDiagramCloud::ApiClient' ) {
        $api_client = $_[0];
    } else {
        $api_client = AsposeDiagramCloud::ApiClient->new(@_);
    }

    my $access_token  =  $api_client->o_auth_post('grant_type' => "client_credentials", 'client_id' => $api_client->{config}->{app_sid}, 'client_secret' =>$api_client->{config}->{app_key})->access_token;
    $api_client->{config}->{access_token} = $access_token;
    my $base_url =  $api_client->{config}->{base_url};
    
    if( substr( $base_url,length($base_url)-1,1) eq '/'){
         $base_url =  $base_url . $api_client->{config}->{api_version};
    }else{
         $base_url =  $base_url . '/'.$api_client->{config}->{api_version};
    }
    
    $api_client->{config}->{base_url} =  $base_url;

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

}


#
# diagram_name_convert_put
#
# Converts document from the request's content to the specified format.
# 
# @param string $name Download document name. (required)
# @param string $file File to upload (required)
# @param string $source_filename Source document name. (optional)
{
    my $params = {
    'name' => {
        data_type => 'string',
        description => 'Download document name.',
        required => '1',
    },
    'file' => {
        data_type => 'string',
        description => 'File to upload',
        required => '1',
    },
    'source_filename' => {
        data_type => 'string',
        description => 'Source document name.',
        required => '0',
    },
    };
    __PACKAGE__->method_documentation->{ 'diagram_name_convert_put' } = { 
    	summary => 'Converts document from the request's content to the specified format.',
        params => $params,
        returns => 'string',
        };
}
# @return string
#
sub diagram_name_convert_put {
    my ($self, %args) = @_;

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

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

    # parse inputs
    my $_resource_path = '/diagram/{name}/convert';

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

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

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

    # 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;
    }

    # form params
    if ( exists $args{'file'} ) {
                $form_params->{'File'} = $self->{api_client}->to_form_value($args{'file'});
    }



( run in 3.739 seconds using v1.01-cache-2.11-cpan-b16cb0d3907 )