File Coverage

lib/Smartcat/Client/DocumentExportApi.pm
Criterion Covered Total %
statement 29 76 38.1
branch 1 22 4.5
condition 2 6 33.3
subroutine 9 11 81.8
pod 0 3 0.0
total 41 118 34.7


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   796 use strict;
  1         2  
  1         30  
25 1     1   5 use warnings;
  1         2  
  1         26  
26 1     1   580 use utf8;
  1         15  
  1         5  
27 1     1   31 use Exporter;
  1         2  
  1         39  
28 1     1   5 use Carp qw( croak );
  1         2  
  1         45  
29 1     1   456 use Log::Any qw($log);
  1         8459  
  1         5  
30              
31 1     1   2631 use Smartcat::Client::ApiClient;
  1         3  
  1         40  
32              
33 1     1   7 use base "Class::Data::Inheritable";
  1         2  
  1         577  
34              
35             __PACKAGE__->mk_classdata( 'method_documentation' => {} );
36              
37             sub new {
38 1     1 0 597 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 $mode (optional)
129             # @param string $type (optional)
130             # @param string $stage_number (optional)
131             {
132             my $params = {
133             'document_ids' => {
134             data_type => 'ARRAY[string]',
135             description => '',
136             required => '1',
137             },
138             'mode' => {
139             data_type => 'string',
140             description => '',
141             required => '0',
142             },
143             'type' => {
144             data_type => 'string',
145             description => '',
146             required => '0',
147             },
148             'stage_number' => {
149             data_type => 'string',
150             description => '',
151             required => '0',
152             },
153             };
154             __PACKAGE__->method_documentation->{'document_export_request_export'} = {
155             summary => '',
156             params => $params,
157             returns => 'ExportDocumentTaskModel',
158             };
159             }
160              
161             # @return ExportDocumentTaskModel
162             #
163             sub document_export_request_export {
164 0     0 0   my ( $self, %args ) = @_;
165              
166             # verify the required parameter 'document_ids' is set
167 0 0         unless ( exists $args{'document_ids'} ) {
168 0           croak(
169             "Missing the required parameter 'document_ids' when calling document_export_request_export"
170             );
171             }
172              
173             # parse inputs
174 0           my $_resource_path = '/api/integration/v1/document/export';
175              
176 0           my $_method = 'POST';
177 0           my $query_params = {};
178 0           my $header_params = {};
179 0           my $form_params = {};
180              
181             # 'Accept' and 'Content-Type' header
182             my $_header_accept = $self->{api_client}
183 0           ->select_header_accept( 'application/json', 'text/json' );
184 0 0         if ($_header_accept) {
185 0           $header_params->{'Accept'} = $_header_accept;
186             }
187             $header_params->{'Content-Type'} =
188 0           $self->{api_client}->select_header_content_type();
189              
190             # query params
191 0 0         if ( exists $args{'document_ids'} ) {
192             $query_params->{'documentIds'} =
193 0           $self->{api_client}->to_query_value( $args{'document_ids'} );
194             }
195              
196             # query params
197 0 0         if ( exists $args{'mode'} ) {
198             $query_params->{'mode'} =
199 0           $self->{api_client}->to_query_value( $args{'mode'} );
200             }
201              
202             # query params
203 0 0         if ( exists $args{'type'} ) {
204             $query_params->{'type'} =
205 0           $self->{api_client}->to_query_value( $args{'type'} );
206             }
207              
208             # query params
209 0 0         if ( exists $args{'stage_number'} ) {
210             $query_params->{'stageNumber'} =
211 0           $self->{api_client}->to_query_value( $args{'stage_number'} );
212             }
213              
214 0           my $_body_data;
215              
216             # authentication setting, if any
217 0           my $auth_settings = [qw()];
218              
219             # make the API Call
220             my $response = $self->{api_client}->call_api(
221 0           $_resource_path, $_method, $query_params, $form_params,
222             $header_params, $_body_data, $auth_settings
223             );
224 0 0         if ( !$response ) {
225 0           return;
226             }
227             my $_response_object =
228 0           $self->{api_client}->deserialize( 'ExportDocumentTaskModel', $response );
229 0           return $_response_object;
230             }
231              
232             1;