
=begin comment

Smartcat Integration API

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

OpenAPI spec version: v1

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 Smartcat::Client::InvoiceApi;

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

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

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

}

#
# invoice_import_job
#
#
#
# @param ImportJobModel $model  (required)
{
    my $params = {
        'model' => {
            data_type   => 'ImportJobModel',
            description => '',
            required    => '1',
        },
    };
    __PACKAGE__->method_documentation->{'invoice_import_job'} = {
        summary => '',
        params  => $params,
        returns => 'string',
    };
}

# @return string
#
sub invoice_import_job {
    my ( $self, %args ) = @_;

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

    # parse inputs
    my $_resource_path = '/api/integration/v1/invoice/job';

    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', 'text/json' );
    if ($_header_accept) {
        $header_params->{'Accept'} = $_header_accept;
    }
    $header_params->{'Content-Type'} = $self->{api_client}
      ->select_header_content_type( 'application/json', 'text/json' );

    my $_body_data;

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

    # 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( 'string', $response );
    return $_response_object;
}

1;
