Fastly/DiffApi.pm untested

filter: Statementstmt 0.0% 0 / 76 Branchbran 0.0% 0 / 20 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 118 CC 11 SCAR 39.9
CC
11
Cov
0%
diff_service_versions
110.0
new
6.0
BEGIN
2.0
CRAP 53.8
1 =begin comment
2  
3 Fastly API
4  
5 Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/)
6  
7 The version of the API Spec document: 1.0.0
8 Contact: oss@fastly.com
9  
10 =end comment
11  
12 =cut
13  
14 #
15 # NOTE: This class is auto generated.
16 # Do not edit the class manually.
17 #
18 package WebService::Fastly::DiffApi;
19  
20 require 5.6.0;
21 use strict;
22 use warnings;
23 use utf8;
24 use Exporter;
25 use Carp qw( croak );
26 use Log::Any qw($log);
27  
28 use WebService::Fastly::ApiClient;
29  
30 use base "Class::Data::Inheritable";
31  
32 __PACKAGE__->mk_classdata('method_documentation' => {});
33  
34 sub new {
35 my $class = shift;
36 my $api_client;
37  
38 if ($_[0] && ref $_[0] && ref $_[0] eq 'WebService::Fastly::ApiClient' ) {
39 $api_client = $_[0];
40 } else {
41 $api_client = WebService::Fastly::ApiClient->new(@_);
42 }
43  
44 bless { api_client => $api_client }, $class;
45  
46 }
47  
48  
49 #
50 # diff_service_versions
51 #
52 # Diff two service versions
53 #
54 # @param string $service_id Alphanumeric string identifying the service. (required)
55 # @param int $from_version_id The version number of the service to which changes in the generated VCL are being compared. Can either be a positive number from 1 to your maximum version or a negative number from -1 down (-1 is latest version etc). (required)
56 # @param int $to_version_id The version number of the service from which changes in the generated VCL are being compared. Uses same numbering scheme as `from`. (required)
57 # @param string $format Optional method to format the diff field. (optional, default to 'text')
58 {
59 my $params = {
60 'service_id' => {
61 data_type => 'string',
62 description => 'Alphanumeric string identifying the service.',
63 required => '1',
64 },
65 'from_version_id' => {
66 data_type => 'int',
67 description => 'The version number of the service to which changes in the generated VCL are being compared. Can either be a positive number from 1 to your maximum version or a negative number from -1 down (-1 is latest version etc).',
68 required => '1',
69 },
70 'to_version_id' => {
71 data_type => 'int',
72 description => 'The version number of the service from which changes in the generated VCL are being compared. Uses same numbering scheme as `from`.',
73 required => '1',
74 },
75 'format' => {
76 data_type => 'string',
77 description => 'Optional method to format the diff field.',
78 required => '0',
79 },
80 };
81 __PACKAGE__->method_documentation->{ 'diff_service_versions' } = {
82 summary => 'Diff two service versions',
83 params => $params,
84 returns => 'DiffResponse',
85 };
86 }
87 # @return DiffResponse
88 #
89 sub diff_service_versions {
90 my ($self, %args) = @_;
91  
92 # verify the required parameter 'service_id' is set
93 unless (exists $args{'service_id'}) {
94 croak("Missing the required parameter 'service_id' when calling diff_service_versions");
95 }
96  
97 # verify the required parameter 'from_version_id' is set
98 unless (exists $args{'from_version_id'}) {
99 croak("Missing the required parameter 'from_version_id' when calling diff_service_versions");
100 }
101  
102 # verify the required parameter 'to_version_id' is set
103 unless (exists $args{'to_version_id'}) {
104 croak("Missing the required parameter 'to_version_id' when calling diff_service_versions");
105 }
106  
107 # parse inputs
108 my $_resource_path = '/service/{service_id}/diff/from/{from_version_id}/to/{to_version_id}';
109  
110 my $_method = 'GET';
111 my $query_params = {};
112 my $header_params = {};
113 my $form_params = {};
114  
115 # 'Accept' and 'Content-Type' header
116 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
117 if ($_header_accept) {
118 $header_params->{'Accept'} = $_header_accept;
119 }
120 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
121  
122 # query params
123 if ( exists $args{'format'}) {
124 $query_params->{'format'} = $self->{api_client}->to_query_value($args{'format'});
125 }
126  
127 # path params
128 if ( exists $args{'service_id'}) {
129 my $_base_variable = "{" . "service_id" . "}";
130 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
131 $_resource_path =~ s/$_base_variable/$_base_value/g;
132 }
133  
134 # path params
135 if ( exists $args{'from_version_id'}) {
136 my $_base_variable = "{" . "from_version_id" . "}";
137 my $_base_value = $self->{api_client}->to_path_value($args{'from_version_id'});
138 $_resource_path =~ s/$_base_variable/$_base_value/g;
139 }
140  
141 # path params
142 if ( exists $args{'to_version_id'}) {
143 my $_base_variable = "{" . "to_version_id" . "}";
144 my $_base_value = $self->{api_client}->to_path_value($args{'to_version_id'});
145 $_resource_path =~ s/$_base_variable/$_base_value/g;
146 }
147  
148 my $_body_data;
149 # authentication setting, if any
150 my $auth_settings = [qw(token )];
151  
152 # make the API Call
153 my $response = $self->{api_client}->call_api($_resource_path, $_method,
154 $query_params, $form_params,
155 $header_params, $_body_data, $auth_settings);
156 if (!$response) {
157 return;
158 }
159 my $_response_object = $self->{api_client}->deserialize('DiffResponse', $response);
160 return $_response_object;
161 }
162  
163 1;