# # Copyright 2015 Reverb Technologies, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # # NOTE: This class is auto generated by the swagger code generator program. # Do not edit the class manually. # require 5.6.0; use strict; use warnings; #use WWW::Swagger::Model::Category; #use WWW::Swagger::Model::Pet; package WWW::Swagger::UserApi; our $VERSION = '2.09'; sub new { my $class = shift; my $options = shift; croak("You must supply an API client") unless $options->{api_client}; my $self = { api_client => $options->{api_client} }; bless $self, $class; } # # create_user # # Create user # # @param User $body Created user object (required) # @return void # sub create_user { my $self = shift; my %args = @_; # parse inputs my $resource_path = "/user"; $resource_path =~ s/{format}/json/; my $method = "POST"; my $query_params = {}; my $header_params = {}; my $form_params = {}; $header_params->{'Accept'} = 'application/json,application/xml'; $header_params->{'Content-Type'} = ''; my $body; # body params if (isset($body)) { $body = $body; } # for HTTP post (form) $body = $body ? undef : $form_params; if ($header_params->{'Content-Type'} eq "application/x-www-form-urlencoded") { $body = http_build_query($body); } # make the API Call my $response = $self->api_client->call_api($resource_path, $method, $query_params, $body, $header_params); } # # create_users_with_array_input # # Creates list of users with given input array # # @param array[User] $body List of user object (required) # @return void # sub create_users_with_array_input { my $self = shift; my %args = @_; # parse inputs my $resource_path = "/user/createWithArray"; $resource_path =~ s/{format}/json/; my $method = "POST"; my $query_params = {}; my $header_params = {}; my $form_params = {}; $header_params->{'Accept'} = 'application/json,application/xml'; $header_params->{'Content-Type'} = ''; my $body; # body params if (isset($body)) { $body = $body; } # for HTTP post (form) $body = $body ? undef : $form_params; if ($header_params->{'Content-Type'} eq "application/x-www-form-urlencoded") { $body = http_build_query($body); } # make the API Call my $response = $self->api_client->call_api($resource_path, $method, $query_params, $body, $header_params); } # # create_users_with_list_input # # Creates list of users with given input array # # @param array[User] $body List of user object (required) # @return void # sub create_users_with_list_input { my $self = shift; my %args = @_; # parse inputs my $resource_path = "/user/createWithList"; $resource_path =~ s/{format}/json/; my $method = "POST"; my $query_params = {}; my $header_params = {}; my $form_params = {}; $header_params->{'Accept'} = 'application/json,application/xml'; $header_params->{'Content-Type'} = ''; my $body; # body params if (isset($body)) { $body = $body; } # for HTTP post (form) $body = $body ? undef : $form_params; if ($header_params->{'Content-Type'} eq "application/x-www-form-urlencoded") { $body = http_build_query($body); } # make the API Call my $response = $self->api_client->call_api($resource_path, $method, $query_params, $body, $header_params); } # # login_user # # Logs user into the system # # @param string $username The user name for login (required) # @param string $password The password for login in clear text (required) # @return string # sub login_user { my $self = shift; my %args = @_; # parse inputs my $resource_path = "/user/login"; $resource_path =~ s/{format}/json/; my $method = "GET"; my $query_params = {}; my $header_params = {}; my $form_params = {}; $header_params->{'Accept'} = 'application/json,application/xml'; $header_params->{'Content-Type'} = ''; # query params if($args{ username }) { $query_params->{'username'} = $self->api_client->to_query_value($args{ username }); } # query params if($args{ password }) { $query_params->{'password'} = $self->api_client->to_query_value($args{ password }); } my $body; # for HTTP post (form) $body = $body ? undef : $form_params; if ($header_params->{'Content-Type'} eq "application/x-www-form-urlencoded") { $body = http_build_query($body); } # make the API Call my $response = $self->api_client->call_api($resource_path, $method, $query_params, $body, $header_params); if(!$response) { return; } my $response_object = $self->api_client->deserialize($response, 'string'); return $response_object; } # # logout_user # # Logs out current logged in user session # # @return void # sub logout_user { my $self = shift; my %args = @_; # parse inputs my $resource_path = "/user/logout"; $resource_path =~ s/{format}/json/; my $method = "GET"; my $query_params = {}; my $header_params = {}; my $form_params = {}; $header_params->{'Accept'} = 'application/json,application/xml'; $header_params->{'Content-Type'} = ''; my $body; # for HTTP post (form) $body = $body ? undef : $form_params; if ($header_params->{'Content-Type'} eq "application/x-www-form-urlencoded") { $body = http_build_query($body); } # make the API Call my $response = $self->api_client->call_api($resource_path, $method, $query_params, $body, $header_params); } # # get_user_by_name # # Get user by user name # # @param string $username The name that needs to be fetched. Use user1 for testing. (required) # @return User # sub get_user_by_name { my $self = shift; my %args = @_; # parse inputs my $resource_path = "/user/{username}"; $resource_path =~ s/{format}/json/; my $method = "GET"; my $query_params = {}; my $header_params = {}; my $form_params = {}; $header_params->{'Accept'} = 'application/json,application/xml'; $header_params->{'Content-Type'} = ''; # path params if( $args{ username }) { my $base_variable = "{" + "username" + "}"; my $base_value = $self->api_client->to_path_value($args{ username }); $resource_path = s/$base_variable/$base_value/; } my $body; # for HTTP post (form) $body = $body ? undef : $form_params; if ($header_params->{'Content-Type'} eq "application/x-www-form-urlencoded") { $body = http_build_query($body); } # make the API Call my $response = $self->api_client->call_api($resource_path, $method, $query_params, $body, $header_params); if(!$response) { return; } my $response_object = $self->api_client->deserialize($response, 'User'); return $response_object; } # # update_user # # Updated user # # @param string $username name that need to be deleted (required) # @param User $body Updated user object (required) # @return void # sub update_user { my $self = shift; my %args = @_; # parse inputs my $resource_path = "/user/{username}"; $resource_path =~ s/{format}/json/; my $method = "PUT"; my $query_params = {}; my $header_params = {}; my $form_params = {}; $header_params->{'Accept'} = 'application/json,application/xml'; $header_params->{'Content-Type'} = ''; # path params if( $args{ username }) { my $base_variable = "{" + "username" + "}"; my $base_value = $self->api_client->to_path_value($args{ username }); $resource_path = s/$base_variable/$base_value/; } my $body; # body params if (isset($body)) { $body = $body; } # for HTTP post (form) $body = $body ? undef : $form_params; if ($header_params->{'Content-Type'} eq "application/x-www-form-urlencoded") { $body = http_build_query($body); } # make the API Call my $response = $self->api_client->call_api($resource_path, $method, $query_params, $body, $header_params); } # # delete_user # # Delete user # # @param string $username The name that needs to be deleted (required) # @return void # sub delete_user { my $self = shift; my %args = @_; # parse inputs my $resource_path = "/user/{username}"; $resource_path =~ s/{format}/json/; my $method = "DELETE"; my $query_params = {}; my $header_params = {}; my $form_params = {}; $header_params->{'Accept'} = 'application/json,application/xml'; $header_params->{'Content-Type'} = ''; # path params if( $args{ username }) { my $base_variable = "{" + "username" + "}"; my $base_value = $self->api_client->to_path_value($args{ username }); $resource_path = s/$base_variable/$base_value/; } my $body; # for HTTP post (form) $body = $body ? undef : $form_params; if ($header_params->{'Content-Type'} eq "application/x-www-form-urlencoded") { $body = http_build_query($body); } # make the API Call my $response = $self->api_client->call_api($resource_path, $method, $query_params, $body, $header_params); } 1;