2016-03-14 17:25:11 +08:00

9.2 KiB

::UserApi

Load the API package

use ::Object::UserApi;

All URIs are relative to http://petstore.swagger.io/v2

Method HTTP request Description
createUser POST /user Create user
createUsersWithArrayInput POST /user/createWithArray Creates list of users with given input array
createUsersWithListInput POST /user/createWithList Creates list of users with given input array
deleteUser DELETE /user/{username} Delete user
getUserByName GET /user/{username} Get user by user name
loginUser GET /user/login Logs user into the system
logoutUser GET /user/logout Logs out current logged in user session
updateUser PUT /user/{username} Updated user

createUser

createUser(body => $body)

Create user

This can only be done by the logged in user.

Example

use Data::Dumper;

my $api = ::UserApi->new();
my $body = ::Object::\Swagger\Client\Model\User->new(); # [\Swagger\Client\Model\User] Created user object

eval { 
    $api->createUser(body => $body);
};
if ($@) {
    warn "Exception when calling UserApi->createUser: $@\n";
}

Parameters

Name Type Description Notes
body \Swagger\Client\Model\User Created user object [optional]

Return type

void (empty response body)

Authorization

No authorization required

HTTP reuqest headers

  • Content-Type: Not defined
  • Accept: application/json, application/xml

[Back to top] [Back to API list] [Back to Model list] [Back to README]

createUsersWithArrayInput

createUsersWithArrayInput(body => $body)

Creates list of users with given input array

Example

use Data::Dumper;

my $api = ::UserApi->new();
my $body = (::Object::\Swagger\Client\Model\User[]->new()); # [\Swagger\Client\Model\User[]] List of user object

eval { 
    $api->createUsersWithArrayInput(body => $body);
};
if ($@) {
    warn "Exception when calling UserApi->createUsersWithArrayInput: $@\n";
}

Parameters

Name Type Description Notes
body \Swagger\Client\Model\User[] List of user object [optional]

Return type

void (empty response body)

Authorization

No authorization required

HTTP reuqest headers

  • Content-Type: Not defined
  • Accept: application/json, application/xml

[Back to top] [Back to API list] [Back to Model list] [Back to README]

createUsersWithListInput

createUsersWithListInput(body => $body)

Creates list of users with given input array

Example

use Data::Dumper;

my $api = ::UserApi->new();
my $body = (::Object::\Swagger\Client\Model\User[]->new()); # [\Swagger\Client\Model\User[]] List of user object

eval { 
    $api->createUsersWithListInput(body => $body);
};
if ($@) {
    warn "Exception when calling UserApi->createUsersWithListInput: $@\n";
}

Parameters

Name Type Description Notes
body \Swagger\Client\Model\User[] List of user object [optional]

Return type

void (empty response body)

Authorization

No authorization required

HTTP reuqest headers

  • Content-Type: Not defined
  • Accept: application/json, application/xml

[Back to top] [Back to API list] [Back to Model list] [Back to README]

deleteUser

deleteUser(username => $username)

Delete user

This can only be done by the logged in user.

Example

use Data::Dumper;

# Configure HTTP basic authorization: test_http_basic
::Configuration::username = 'YOUR_USERNAME';
::Configuration::password = 'YOUR_PASSWORD';

my $api = ::UserApi->new();
my $username = username_example; # [string] The name that needs to be deleted

eval { 
    $api->deleteUser(username => $username);
};
if ($@) {
    warn "Exception when calling UserApi->deleteUser: $@\n";
}

Parameters

Name Type Description Notes
username string The name that needs to be deleted

Return type

void (empty response body)

Authorization

test_http_basic

HTTP reuqest headers

  • Content-Type: Not defined
  • Accept: application/json, application/xml

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getUserByName

\Swagger\Client\Model\User getUserByName(username => $username)

Get user by user name

Example

use Data::Dumper;

my $api = ::UserApi->new();
my $username = username_example; # [string] The name that needs to be fetched. Use user1 for testing.

eval { 
    my $result = $api->getUserByName(username => $username);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling UserApi->getUserByName: $@\n";
}

Parameters

Name Type Description Notes
username string The name that needs to be fetched. Use user1 for testing.

Return type

\Swagger\Client\Model\User

Authorization

No authorization required

HTTP reuqest headers

  • Content-Type: Not defined
  • Accept: application/json, application/xml

[Back to top] [Back to API list] [Back to Model list] [Back to README]

loginUser

string loginUser(username => $username, password => $password)

Logs user into the system

Example

use Data::Dumper;

my $api = ::UserApi->new();
my $username = username_example; # [string] The user name for login
my $password = password_example; # [string] The password for login in clear text

eval { 
    my $result = $api->loginUser(username => $username, password => $password);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling UserApi->loginUser: $@\n";
}

Parameters

Name Type Description Notes
username string The user name for login [optional]
password string The password for login in clear text [optional]

Return type

string

Authorization

No authorization required

HTTP reuqest headers

  • Content-Type: Not defined
  • Accept: application/json, application/xml

[Back to top] [Back to API list] [Back to Model list] [Back to README]

logoutUser

logoutUser()

Logs out current logged in user session

Example

use Data::Dumper;

my $api = ::UserApi->new();

eval { 
    $api->logoutUser();
};
if ($@) {
    warn "Exception when calling UserApi->logoutUser: $@\n";
}

Parameters

This endpoint does not need any parameter.

Return type

void (empty response body)

Authorization

No authorization required

HTTP reuqest headers

  • Content-Type: Not defined
  • Accept: application/json, application/xml

[Back to top] [Back to API list] [Back to Model list] [Back to README]

updateUser

updateUser(username => $username, body => $body)

Updated user

This can only be done by the logged in user.

Example

use Data::Dumper;

my $api = ::UserApi->new();
my $username = username_example; # [string] name that need to be deleted
my $body = ::Object::\Swagger\Client\Model\User->new(); # [\Swagger\Client\Model\User] Updated user object

eval { 
    $api->updateUser(username => $username, body => $body);
};
if ($@) {
    warn "Exception when calling UserApi->updateUser: $@\n";
}

Parameters

Name Type Description Notes
username string name that need to be deleted
body \Swagger\Client\Model\User Updated user object [optional]

Return type

void (empty response body)

Authorization

No authorization required

HTTP reuqest headers

  • Content-Type: Not defined
  • Accept: application/json, application/xml

[Back to top] [Back to API list] [Back to Model list] [Back to README]