| 1 | =begin comment | ||
| 2 | |||
| 3 | QueryBuilderApi | ||
| 4 | |||
| 5 | Active Query Builder Web API lets create, analyze and modify SQL queries for different database servers using RESTful HTTP requests to a cloud-based service. It requires SQL execution context (information about database schema and used database server) to be stored under the registered account at https://webapi.activequerybuilder.com/. | ||
| 6 | |||
| 7 | OpenAPI spec version: 1.1.8 | ||
| 8 | Contact: support@activedbsoft.com | ||
| 9 | Generated by: https://github.com/swagger-api/swagger-codegen.git | ||
| 10 | |||
| 11 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 12 | you may not use this file except in compliance with the License. | ||
| 13 | You may obtain a copy of the License at | ||
| 14 | |||
| 15 | http://www.apache.org/licenses/LICENSE-2.0 | ||
| 16 | |||
| 17 | Unless required by applicable law or agreed to in writing, software | ||
| 18 | distributed under the License is distributed on an "AS IS" BASIS, | ||
| 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 20 | See the License for the specific language governing permissions and | ||
| 21 | limitations under the License. | ||
| 22 | |||
| 23 | =end comment | ||
| 24 | |||
| 25 | =cut | ||
| 26 | |||
| 27 | # | ||
| 28 | # NOTE: This class is auto generated by the swagger code generator program. | ||
| 29 | # Do not edit the class manually. | ||
| 30 | # Ref: https://github.com/swagger-api/swagger-codegen | ||
| 31 | # | ||
| 32 | package SQL::QueryBuilder::WebApi::ActiveQueryBuilderApi; | ||
| 33 | |||
| 34 | require 5.6.0; | ||
| 35 | use strict; | ||
| 36 | use warnings; | ||
| 37 | use utf8; | ||
| 38 | use Exporter; | ||
| 39 | use Carp qw( croak ); | ||
| 40 | use Log::Any qw($log); | ||
| 41 | |||
| 42 | use SQL::QueryBuilder::WebApi::ApiClient; | ||
| 43 | use SQL::QueryBuilder::WebApi::Configuration; | ||
| 44 | |||
| 45 | use base "Class::Data::Inheritable"; | ||
| 46 | |||
| 47 | __PACKAGE__->mk_classdata('method_documentation' => {}); | ||
| 48 | |||
| 49 | sub new { | ||
| 50 | my $class = shift; | ||
| 51 | my (%self) = ( | ||
| 52 | 'api_client' => SQL::QueryBuilder::WebApi::ApiClient->instance, | ||
| 53 | @_ | ||
| 54 | ); | ||
| 55 | |||
| 56 | #my $self = { | ||
| 57 | # #api_client => $options->{api_client} | ||
| 58 | # api_client => $default_api_client | ||
| 59 | #}; | ||
| 60 | |||
| 61 | bless \%self, $class; | ||
| 62 | |||
| 63 | } | ||
| 64 | |||
| 65 | |||
| 66 | # | ||
| 67 | # get_query_columns_post | ||
| 68 | # | ||
| 69 | # | ||
| 70 | # | ||
| 71 | # @param SqlQuery $query Information about SQL query and it's context. (required) | ||
| 72 | { | ||
| 73 | my $params = { | ||
| 74 | 'query' => { | ||
| 75 | data_type => 'SqlQuery', | ||
| 76 | description => 'Information about SQL query and it's context.', | ||
| 77 | required => '1', | ||
| 78 | }, | ||
| 79 | }; | ||
| 80 | __PACKAGE__->method_documentation->{ 'get_query_columns_post' } = { | ||
| 81 | summary => '', | ||
| 82 | params => $params, | ||
| 83 | returns => 'ARRAY[QueryColumn]', | ||
| 84 | }; | ||
| 85 | } | ||
| 86 | # @return ARRAY[QueryColumn] | ||
| 87 | # | ||
| 88 | sub get_query_columns_post { | ||
| 89 | my ($self, %args) = @_; | ||
| 90 | |||
| 91 | # verify the required parameter 'query' is set | ||
| 92 | unless (exists $args{'query'}) { | ||
| 93 | croak("Missing the required parameter 'query' when calling get_query_columns_post"); | ||
| 94 | } | ||
| 95 | |||
| 96 | # parse inputs | ||
| 97 | my $_resource_path = '/getQueryColumns'; | ||
| 98 | $_resource_path =~ s/{format}/json/; # default format to json | ||
| 99 | |||
| 100 | my $_method = 'POST'; | ||
| 101 | my $query_params = {}; | ||
| 102 | my $header_params = {}; | ||
| 103 | my $form_params = {}; | ||
| 104 | |||
| 105 | # 'Accept' and 'Content-Type' header | ||
| 106 | my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'text/html'); | ||
| 107 | if ($_header_accept) { | ||
| 108 | $header_params->{'Accept'} = $_header_accept; | ||
| 109 | } | ||
| 110 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json', 'text/xml'); | ||
| 111 | |||
| 112 | my $_body_data; | ||
| 113 | # body params | ||
| 114 | if ( exists $args{'query'}) { | ||
| 115 | $_body_data = $args{'query'}; | ||
| 116 | } | ||
| 117 | |||
| 118 | # authentication setting, if any | ||
| 119 | my $auth_settings = [qw()]; | ||
| 120 | |||
| 121 | # make the API Call | ||
| 122 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 123 | $query_params, $form_params, | ||
| 124 | $header_params, $_body_data, $auth_settings); | ||
| 125 | if (!$response) { | ||
| 126 | return; | ||
| 127 | } | ||
| 128 | my $_response_object = $self->{api_client}->deserialize('ARRAY[QueryColumn]', $response); | ||
| 129 | return $_response_object; | ||
| 130 | } | ||
| 131 | |||
| 132 | # | ||
| 133 | # transform_sql_post | ||
| 134 | # | ||
| 135 | # | ||
| 136 | # | ||
| 137 | # @param Transform $transform SQL transformation parameters and commands. (required) | ||
| 138 | { | ||
| 139 | my $params = { | ||
| 140 | 'transform' => { | ||
| 141 | data_type => 'Transform', | ||
| 142 | description => 'SQL transformation parameters and commands.', | ||
| 143 | required => '1', | ||
| 144 | }, | ||
| 145 | }; | ||
| 146 | __PACKAGE__->method_documentation->{ 'transform_sql_post' } = { | ||
| 147 | summary => '', | ||
| 148 | params => $params, | ||
| 149 | returns => 'TransformResult', | ||
| 150 | }; | ||
| 151 | } | ||
| 152 | # @return TransformResult | ||
| 153 | # | ||
| 154 | sub transform_sql_post { | ||
| 155 | my ($self, %args) = @_; | ||
| 156 | |||
| 157 | # verify the required parameter 'transform' is set | ||
| 158 | unless (exists $args{'transform'}) { | ||
| 159 | croak("Missing the required parameter 'transform' when calling transform_sql_post"); | ||
| 160 | } | ||
| 161 | |||
| 162 | # parse inputs | ||
| 163 | my $_resource_path = '/transformSQL'; | ||
| 164 | $_resource_path =~ s/{format}/json/; # default format to json | ||
| 165 | |||
| 166 | my $_method = 'POST'; | ||
| 167 | my $query_params = {}; | ||
| 168 | my $header_params = {}; | ||
| 169 | my $form_params = {}; | ||
| 170 | |||
| 171 | # 'Accept' and 'Content-Type' header | ||
| 172 | my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'text/html'); | ||
| 173 | if ($_header_accept) { | ||
| 174 | $header_params->{'Accept'} = $_header_accept; | ||
| 175 | } | ||
| 176 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json', 'text/xml'); | ||
| 177 | |||
| 178 | my $_body_data; | ||
| 179 | # body params | ||
| 180 | if ( exists $args{'transform'}) { | ||
| 181 | $_body_data = $args{'transform'}; | ||
| 182 | } | ||
| 183 | |||
| 184 | # authentication setting, if any | ||
| 185 | my $auth_settings = [qw()]; | ||
| 186 | |||
| 187 | # make the API Call | ||
| 188 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 189 | $query_params, $form_params, | ||
| 190 | $header_params, $_body_data, $auth_settings); | ||
| 191 | if (!$response) { | ||
| 192 | return; | ||
| 193 | } | ||
| 194 | my $_response_object = $self->{api_client}->deserialize('TransformResult', $response); | ||
| 195 | return $_response_object; | ||
| 196 | } | ||
| 197 | |||
| 198 | 1; |