File Coverage

lib/Smartcat/Client/DocumentExportApi.pm
Criterion Covered Total %
statement 29 74 39.1
branch 1 20 5.0
condition 2 6 33.3
subroutine 9 11 81.8
pod 0 3 0.0
total 41 114 35.9


line stmt bran cond sub pod time code
1              
2             =begin comment
3              
4             Smartcat Integration API
5              
6             No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
7              
8             OpenAPI spec version: v1
9              
10             Generated by: https://github.com/swagger-api/swagger-codegen.git
11              
12             =end comment
13              
14             =cut
15              
16             #
17             # NOTE: This class is auto generated by the swagger code generator program.
18             # Do not edit the class manually.
19             # Ref: https://github.com/swagger-api/swagger-codegen
20             #
21             package Smartcat::Client::DocumentExportApi;
22              
23             require 5.6.0;
24 1     1   769 use strict;
  1         3  
  1         31  
25 1     1   5 use warnings;
  1         2  
  1         25  
26 1     1   593 use utf8;
  1         17  
  1         4  
27 1     1   32 use Exporter;
  1         2  
  1         36  
28 1     1   5 use Carp qw( croak );
  1         2  
  1         48  
29 1     1   453 use Log::Any qw($log);
  1         8756  
  1         4  
30              
31 1     1   2679 use Smartcat::Client::ApiClient;
  1         3  
  1         45  
32              
33 1     1   8 use base "Class::Data::Inheritable";
  1         1  
  1         484  
34              
35             __PACKAGE__->mk_classdata( 'method_documentation' => {} );
36              
37             sub new {
38 1     1 0 609 my $class = shift;
39 1         2 my $api_client;
40              
41 1 50 33     6 if ( $_[0] && ref $_[0] && ref $_[0] eq 'Smartcat::Client::ApiClient' ) {
      33        
42 0         0 $api_client = $_[0];
43             }
44             else {
45 1         6 $api_client = Smartcat::Client::ApiClient->new(@_);
46             }
47              
48 1         6 bless { api_client => $api_client }, $class;
49              
50             }
51              
52             #
53             # document_export_download_export_result
54             #
55             # Download the results of export
56             #
57             # @param string $task_id Export task ID (required)
58             {
59             my $params = {
60             'task_id' => {
61             data_type => 'string',
62             description => 'Export task ID',
63             required => '1',
64             },
65             };
66             __PACKAGE__->method_documentation->{
67             'document_export_download_export_result'} = {
68             summary => 'Download the results of export',
69             params => $params,
70             returns => 'File',
71             };
72             }
73              
74             # @return File
75             #
76             sub document_export_download_export_result {
77 0     0 0   my ( $self, %args ) = @_;
78              
79             # verify the required parameter 'task_id' is set
80 0 0         unless ( exists $args{'task_id'} ) {
81 0           croak(
82             "Missing the required parameter 'task_id' when calling document_export_download_export_result"
83             );
84             }
85              
86             # parse inputs
87 0           my $_resource_path = '/api/integration/v1/document/export/{taskId}';
88              
89 0           my $_method = 'GET';
90 0           my $query_params = {};
91 0           my $header_params = {};
92 0           my $form_params = {};
93              
94             # 'Accept' and 'Content-Type' header
95 0           my $_header_accept = $self->{api_client}->select_header_accept();
96 0 0         if ($_header_accept) {
97 0           $header_params->{'Accept'} = $_header_accept;
98             }
99             $header_params->{'Content-Type'} =
100 0           $self->{api_client}->select_header_content_type();
101              
102             # path params
103 0 0         if ( exists $args{'task_id'} ) {
104 0           my $_base_variable = "{" . "taskId" . "}";
105             my $_base_value =
106 0           $self->{api_client}->to_path_value( $args{'task_id'} );
107 0           $_resource_path =~ s/$_base_variable/$_base_value/g;
108             }
109              
110 0           my $_body_data;
111              
112             # authentication setting, if any
113 0           my $auth_settings = [qw()];
114              
115             # make the internal API Call
116             return $self->{api_client}->_call_api(
117 0           $_resource_path, $_method, $query_params, $form_params,
118             $header_params, $_body_data, $auth_settings
119             );
120             }
121              
122             #
123             # document_export_request_export
124             #
125             #
126             #
127             # @param ARRAY[string] $document_ids (required)
128             # @param string $type (optional)
129             # @param int $stage_number (optional)
130             {
131             my $params = {
132             'document_ids' => {
133             data_type => 'ARRAY[string]',
134             description => '',
135             required => '1',
136             },
137             'type' => {
138             data_type => 'string',
139             description => '',
140             required => '0',
141             },
142             'stage_number' => {
143             data_type => 'int',
144             description => '',
145             required => '0',
146             },
147             };
148             __PACKAGE__->method_documentation->{'document_export_request_export'} = {
149             summary => '',
150             params => $params,
151             returns => 'ExportDocumentTaskModel',
152             };
153             }
154              
155             # @return ExportDocumentTaskModel
156             #
157             sub document_export_request_export {
158 0     0 0   my ( $self, %args ) = @_;
159              
160             # verify the required parameter 'document_ids' is set
161 0 0         unless ( exists $args{'document_ids'} ) {
162 0           croak(
163             "Missing the required parameter 'document_ids' when calling document_export_request_export"
164             );
165             }
166              
167             # parse inputs
168 0           my $_resource_path = '/api/integration/v1/document/export';
169              
170 0           my $_method = 'POST';
171 0           my $query_params = {};
172 0           my $header_params = {};
173 0           my $form_params = {};
174              
175             # 'Accept' and 'Content-Type' header
176             my $_header_accept = $self->{api_client}
177 0           ->select_header_accept( 'application/json', 'text/json' );
178 0 0         if ($_header_accept) {
179 0           $header_params->{'Accept'} = $_header_accept;
180             }
181             $header_params->{'Content-Type'} =
182 0           $self->{api_client}->select_header_content_type();
183              
184             # query params
185 0 0         if ( exists $args{'document_ids'} ) {
186             $query_params->{'documentIds'} =
187 0           $self->{api_client}->to_query_value( $args{'document_ids'} );
188             }
189              
190             # query params
191 0 0         if ( exists $args{'type'} ) {
192             $query_params->{'type'} =
193 0           $self->{api_client}->to_query_value( $args{'type'} );
194             }
195              
196             # query params
197 0 0         if ( exists $args{'stage_number'} ) {
198             $query_params->{'stageNumber'} =
199 0           $self->{api_client}->to_query_value( $args{'stage_number'} );
200             }
201              
202 0           my $_body_data;
203              
204             # authentication setting, if any
205 0           my $auth_settings = [qw()];
206              
207             # make the API Call
208             my $response = $self->{api_client}->call_api(
209 0           $_resource_path, $_method, $query_params, $form_params,
210             $header_params, $_body_data, $auth_settings
211             );
212 0 0         if ( !$response ) {
213 0           return;
214             }
215             my $_response_object =
216 0           $self->{api_client}->deserialize( 'ExportDocumentTaskModel', $response );
217 0           return $_response_object;
218             }
219              
220             1;