mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-11 02:12:45 +00:00
[ruby] document the *_with_http_info methods (#8094)
This commit is contained in:
@@ -22,20 +22,37 @@ Create user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
### Examples
|
||||
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::UserApi.new
|
||||
user = Petstore::User.new # User | Created user object
|
||||
|
||||
begin
|
||||
#Create user
|
||||
# Create user
|
||||
api_instance.create_user(user)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling UserApi->create_user: #{e}"
|
||||
puts "Error when calling UserApi->create_user: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
#### Using the create_user_with_http_info variant
|
||||
|
||||
This returns an Array which contains the response data (`nil` in this case), status code and headers.
|
||||
|
||||
> <Array(nil, Integer, Hash)> create_user_with_http_info(user)
|
||||
|
||||
```ruby
|
||||
begin
|
||||
# Create user
|
||||
data, status_code, headers = api_instance.create_user_with_http_info(user)
|
||||
p status_code # => 2xx
|
||||
p headers # => { ... }
|
||||
p data # => nil
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Error when calling UserApi->create_user_with_http_info: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -65,20 +82,37 @@ No authorization required
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
### Example
|
||||
### Examples
|
||||
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::UserApi.new
|
||||
user = [Petstore::User.new] # Array<User> | List of user object
|
||||
|
||||
begin
|
||||
#Creates list of users with given input array
|
||||
# Creates list of users with given input array
|
||||
api_instance.create_users_with_array_input(user)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling UserApi->create_users_with_array_input: #{e}"
|
||||
puts "Error when calling UserApi->create_users_with_array_input: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
#### Using the create_users_with_array_input_with_http_info variant
|
||||
|
||||
This returns an Array which contains the response data (`nil` in this case), status code and headers.
|
||||
|
||||
> <Array(nil, Integer, Hash)> create_users_with_array_input_with_http_info(user)
|
||||
|
||||
```ruby
|
||||
begin
|
||||
# Creates list of users with given input array
|
||||
data, status_code, headers = api_instance.create_users_with_array_input_with_http_info(user)
|
||||
p status_code # => 2xx
|
||||
p headers # => { ... }
|
||||
p data # => nil
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Error when calling UserApi->create_users_with_array_input_with_http_info: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -108,20 +142,37 @@ No authorization required
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
### Example
|
||||
### Examples
|
||||
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::UserApi.new
|
||||
user = [Petstore::User.new] # Array<User> | List of user object
|
||||
|
||||
begin
|
||||
#Creates list of users with given input array
|
||||
# Creates list of users with given input array
|
||||
api_instance.create_users_with_list_input(user)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling UserApi->create_users_with_list_input: #{e}"
|
||||
puts "Error when calling UserApi->create_users_with_list_input: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
#### Using the create_users_with_list_input_with_http_info variant
|
||||
|
||||
This returns an Array which contains the response data (`nil` in this case), status code and headers.
|
||||
|
||||
> <Array(nil, Integer, Hash)> create_users_with_list_input_with_http_info(user)
|
||||
|
||||
```ruby
|
||||
begin
|
||||
# Creates list of users with given input array
|
||||
data, status_code, headers = api_instance.create_users_with_list_input_with_http_info(user)
|
||||
p status_code # => 2xx
|
||||
p headers # => { ... }
|
||||
p data # => nil
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Error when calling UserApi->create_users_with_list_input_with_http_info: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -153,20 +204,37 @@ Delete user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
### Examples
|
||||
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::UserApi.new
|
||||
username = 'username_example' # String | The name that needs to be deleted
|
||||
|
||||
begin
|
||||
#Delete user
|
||||
# Delete user
|
||||
api_instance.delete_user(username)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling UserApi->delete_user: #{e}"
|
||||
puts "Error when calling UserApi->delete_user: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
#### Using the delete_user_with_http_info variant
|
||||
|
||||
This returns an Array which contains the response data (`nil` in this case), status code and headers.
|
||||
|
||||
> <Array(nil, Integer, Hash)> delete_user_with_http_info(username)
|
||||
|
||||
```ruby
|
||||
begin
|
||||
# Delete user
|
||||
data, status_code, headers = api_instance.delete_user_with_http_info(username)
|
||||
p status_code # => 2xx
|
||||
p headers # => { ... }
|
||||
p data # => nil
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Error when calling UserApi->delete_user_with_http_info: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -192,25 +260,42 @@ No authorization required
|
||||
|
||||
## get_user_by_name
|
||||
|
||||
> User get_user_by_name(username)
|
||||
> <User> get_user_by_name(username)
|
||||
|
||||
Get user by user name
|
||||
|
||||
### Example
|
||||
### Examples
|
||||
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::UserApi.new
|
||||
username = 'username_example' # String | The name that needs to be fetched. Use user1 for testing.
|
||||
|
||||
begin
|
||||
#Get user by user name
|
||||
# Get user by user name
|
||||
result = api_instance.get_user_by_name(username)
|
||||
p result
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling UserApi->get_user_by_name: #{e}"
|
||||
puts "Error when calling UserApi->get_user_by_name: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
#### Using the get_user_by_name_with_http_info variant
|
||||
|
||||
This returns an Array which contains the response data, status code and headers.
|
||||
|
||||
> <Array(<User>, Integer, Hash)> get_user_by_name_with_http_info(username)
|
||||
|
||||
```ruby
|
||||
begin
|
||||
# Get user by user name
|
||||
data, status_code, headers = api_instance.get_user_by_name_with_http_info(username)
|
||||
p status_code # => 2xx
|
||||
p headers # => { ... }
|
||||
p data # => <User>
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Error when calling UserApi->get_user_by_name_with_http_info: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -240,10 +325,9 @@ No authorization required
|
||||
|
||||
Logs user into the system
|
||||
|
||||
### Example
|
||||
### Examples
|
||||
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::UserApi.new
|
||||
@@ -251,11 +335,29 @@ username = 'username_example' # String | The user name for login
|
||||
password = 'password_example' # String | The password for login in clear text
|
||||
|
||||
begin
|
||||
#Logs user into the system
|
||||
# Logs user into the system
|
||||
result = api_instance.login_user(username, password)
|
||||
p result
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling UserApi->login_user: #{e}"
|
||||
puts "Error when calling UserApi->login_user: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
#### Using the login_user_with_http_info variant
|
||||
|
||||
This returns an Array which contains the response data, status code and headers.
|
||||
|
||||
> <Array(String, Integer, Hash)> login_user_with_http_info(username, password)
|
||||
|
||||
```ruby
|
||||
begin
|
||||
# Logs user into the system
|
||||
data, status_code, headers = api_instance.login_user_with_http_info(username, password)
|
||||
p status_code # => 2xx
|
||||
p headers # => { ... }
|
||||
p data # => String
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Error when calling UserApi->login_user_with_http_info: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -286,19 +388,36 @@ No authorization required
|
||||
|
||||
Logs out current logged in user session
|
||||
|
||||
### Example
|
||||
### Examples
|
||||
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::UserApi.new
|
||||
|
||||
begin
|
||||
#Logs out current logged in user session
|
||||
# Logs out current logged in user session
|
||||
api_instance.logout_user
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling UserApi->logout_user: #{e}"
|
||||
puts "Error when calling UserApi->logout_user: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
#### Using the logout_user_with_http_info variant
|
||||
|
||||
This returns an Array which contains the response data (`nil` in this case), status code and headers.
|
||||
|
||||
> <Array(nil, Integer, Hash)> logout_user_with_http_info
|
||||
|
||||
```ruby
|
||||
begin
|
||||
# Logs out current logged in user session
|
||||
data, status_code, headers = api_instance.logout_user_with_http_info
|
||||
p status_code # => 2xx
|
||||
p headers # => { ... }
|
||||
p data # => nil
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Error when calling UserApi->logout_user_with_http_info: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -328,10 +447,9 @@ Updated user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
### Examples
|
||||
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::UserApi.new
|
||||
@@ -339,10 +457,28 @@ username = 'username_example' # String | name that need to be deleted
|
||||
user = Petstore::User.new # User | Updated user object
|
||||
|
||||
begin
|
||||
#Updated user
|
||||
# Updated user
|
||||
api_instance.update_user(username, user)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling UserApi->update_user: #{e}"
|
||||
puts "Error when calling UserApi->update_user: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
#### Using the update_user_with_http_info variant
|
||||
|
||||
This returns an Array which contains the response data (`nil` in this case), status code and headers.
|
||||
|
||||
> <Array(nil, Integer, Hash)> update_user_with_http_info(username, user)
|
||||
|
||||
```ruby
|
||||
begin
|
||||
# Updated user
|
||||
data, status_code, headers = api_instance.update_user_with_http_info(username, user)
|
||||
p status_code # => 2xx
|
||||
p headers # => { ... }
|
||||
p data # => nil
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Error when calling UserApi->update_user_with_http_info: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user