mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-12 12:40:53 +00:00
fix ruby parameters in documentation, fix reuqiredParams, optionalParams
This commit is contained in:
parent
26f08aa8ad
commit
a08164592a
@ -34,6 +34,7 @@ public class CodegenOperation {
|
||||
public List<CodegenParameter> formParams = new ArrayList<CodegenParameter>();
|
||||
public List<CodegenParameter> cookieParams = new ArrayList<CodegenParameter>();
|
||||
public List<CodegenParameter> requiredParams = new ArrayList<CodegenParameter>();
|
||||
public List<CodegenParameter> optionalParams = new ArrayList<CodegenParameter>();
|
||||
public List<CodegenSecurity> authMethods;
|
||||
public List<Tag> tags;
|
||||
public List<CodegenResponse> responses = new ArrayList<CodegenResponse>();
|
||||
@ -111,6 +112,24 @@ public class CodegenOperation {
|
||||
return nonempty(cookieParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there's at least one optional parameter
|
||||
*
|
||||
* @return true if any optional parameter exists, false otherwise
|
||||
*/
|
||||
public boolean getHasOptionalParams() {
|
||||
return nonempty(optionalParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there's at least one required parameter
|
||||
*
|
||||
* @return true if any optional parameter exists, false otherwise
|
||||
*/
|
||||
public boolean getHasRequiredParams() {
|
||||
return nonempty(requiredParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there's at least one example parameter
|
||||
*
|
||||
@ -293,6 +312,10 @@ public class CodegenOperation {
|
||||
return false;
|
||||
if (cookieParams != null ? !cookieParams.equals(that.cookieParams) : that.cookieParams != null)
|
||||
return false;
|
||||
if (requiredParams != null ? !requiredParams.equals(that.requiredParams) : that.requiredParams!= null)
|
||||
return false;
|
||||
if (optionalParams != null ? !optionalParams.equals(that.optionalParams) : that.optionalParams!= null)
|
||||
return false;
|
||||
if (authMethods != null ? !authMethods.equals(that.authMethods) : that.authMethods != null)
|
||||
return false;
|
||||
if (tags != null ? !tags.equals(that.tags) : that.tags != null)
|
||||
@ -360,6 +383,8 @@ public class CodegenOperation {
|
||||
result = 31 * result + (headerParams != null ? headerParams.hashCode() : 0);
|
||||
result = 31 * result + (formParams != null ? formParams.hashCode() : 0);
|
||||
result = 31 * result + (cookieParams != null ? cookieParams.hashCode() : 0);
|
||||
result = 31 * result + (requiredParams!= null ? requiredParams.hashCode() : 0);
|
||||
result = 31 * result + (optionalParams != null ? optionalParams.hashCode() : 0);
|
||||
result = 31 * result + (authMethods != null ? authMethods.hashCode() : 0);
|
||||
result = 31 * result + (tags != null ? tags.hashCode() : 0);
|
||||
result = 31 * result + (responses != null ? responses.hashCode() : 0);
|
||||
|
@ -2135,6 +2135,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
List<CodegenParameter> cookieParams = new ArrayList<CodegenParameter>();
|
||||
List<CodegenParameter> formParams = new ArrayList<CodegenParameter>();
|
||||
List<CodegenParameter> requiredParams = new ArrayList<CodegenParameter>();
|
||||
List<CodegenParameter> optionalParams = new ArrayList<CodegenParameter>();
|
||||
|
||||
CodegenParameter bodyParam = null;
|
||||
RequestBody requestBody = operation.getRequestBody();
|
||||
@ -2202,9 +2203,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
for (CodegenParameter cp : bodyParams) {
|
||||
allParams.add(cp.copy());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ensure unique parameter name
|
||||
for (CodegenParameter cp : allParams) {
|
||||
if (ensureUniqueParams) {
|
||||
if (isParameterNameUnique(cp, allParams)) {
|
||||
@ -2213,9 +2214,14 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
cp.paramName = generateNextName(cp.paramName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// create optional, required parameters
|
||||
for (CodegenParameter cp : allParams) {
|
||||
if (cp.required) { //required parameters
|
||||
requiredParams.add(cp.copy());
|
||||
} else { // optional parameters
|
||||
optionalParams.add(cp.copy());
|
||||
op.hasOptionalParams = true;
|
||||
}
|
||||
}
|
||||
@ -2250,6 +2256,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
op.cookieParams = addHasMore(cookieParams);
|
||||
op.formParams = addHasMore(formParams);
|
||||
op.requiredParams = addHasMore(requiredParams);
|
||||
op.optionalParams = addHasMore(optionalParams);
|
||||
op.externalDocs = operation.getExternalDocs();
|
||||
// legacy support
|
||||
op.nickname = op.operationId;
|
||||
|
@ -11,7 +11,7 @@ Method | HTTP request | Description
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
# **{{operationId}}**
|
||||
> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}{{#hasParams}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}){{/hasParams}}
|
||||
> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}}
|
||||
|
||||
{{{summary}}}{{#notes}}
|
||||
|
||||
@ -36,17 +36,23 @@ require '{{{gemName}}}'
|
||||
{{/authMethods}}end
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
api_instance = {{{moduleName}}}::{{{classname}}}.new{{#hasParams}}
|
||||
{{#vendorExtensions.x-codegen-hasRequiredParams}}{{#allParams}}{{#required}}
|
||||
api_instance = {{{moduleName}}}::{{{classname}}}.new
|
||||
{{#requiredParams}}
|
||||
{{{paramName}}} = {{{example}}} # {{{dataType}}} | {{{description}}}
|
||||
{{/required}}{{/allParams}}{{/vendorExtensions.x-codegen-hasRequiredParams}}{{#hasOptionalParams}}
|
||||
opts = { {{#allParams}}{{^required}}
|
||||
{{{paramName}}}: {{{example}}}{{#vendorExtensions.x-codegen-hasMoreOptional}},{{/vendorExtensions.x-codegen-hasMoreOptional}} # {{{dataType}}} | {{{description}}}{{/required}}{{/allParams}}
|
||||
}{{/hasOptionalParams}}{{/hasParams}}
|
||||
{{/requiredParams}}
|
||||
{{#optionalParams}}
|
||||
{{#-first}}
|
||||
opts = {
|
||||
{{/-first}}
|
||||
{{{paramName}}}: {{{example}}}{{^-last}},{{/-last}} # {{{dataType}}} | {{{description}}}
|
||||
{{#-last}}
|
||||
}
|
||||
{{/-last}}
|
||||
{{/optionalParams}}
|
||||
|
||||
begin
|
||||
{{#summary}} #{{{.}}}
|
||||
{{/summary}} {{#returnType}}result = {{/returnType}}api_instance.{{{operationId}}}{{#hasParams}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}){{/hasParams}}{{#returnType}}
|
||||
{{/summary}} {{#returnType}}result = {{/returnType}}api_instance.{{{operationId}}}{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}}{{#returnType}}
|
||||
p result{{/returnType}}
|
||||
rescue {{{moduleName}}}::ApiError => e
|
||||
puts "Exception when calling {{classname}}->{{{operationId}}}: #{e}"
|
||||
|
@ -20,10 +20,8 @@ To test special tags
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::AnotherFakeApi.new
|
||||
|
||||
client = Petstore::Client.new # Client | client model
|
||||
|
||||
|
||||
begin
|
||||
#To test special tags
|
||||
result = api_instance.test_special_tags(client)
|
||||
|
@ -17,7 +17,7 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **fake_outer_boolean_serialize**
|
||||
> OuterBoolean fake_outer_boolean_serialize()
|
||||
> OuterBoolean fake_outer_boolean_serialize(opts)
|
||||
|
||||
|
||||
|
||||
@ -29,10 +29,12 @@ Test serialization of outer boolean types
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::FakeApi.new
|
||||
|
||||
opts = {
|
||||
UNKNOWN_PARAM_NAME: Petstore::null.new # | Input boolean as post body
|
||||
}
|
||||
|
||||
begin
|
||||
result = api_instance.fake_outer_boolean_serialize()
|
||||
result = api_instance.fake_outer_boolean_serialize(opts)
|
||||
p result
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling FakeApi->fake_outer_boolean_serialize: #{e}"
|
||||
@ -61,7 +63,7 @@ No authorization required
|
||||
|
||||
|
||||
# **fake_outer_composite_serialize**
|
||||
> OuterComposite fake_outer_composite_serialize()
|
||||
> OuterComposite fake_outer_composite_serialize(opts)
|
||||
|
||||
|
||||
|
||||
@ -73,10 +75,12 @@ Test serialization of object with outer number type
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::FakeApi.new
|
||||
|
||||
opts = {
|
||||
outer_composite: Petstore::OuterComposite.new # OuterComposite | Input composite as post body
|
||||
}
|
||||
|
||||
begin
|
||||
result = api_instance.fake_outer_composite_serialize()
|
||||
result = api_instance.fake_outer_composite_serialize(opts)
|
||||
p result
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling FakeApi->fake_outer_composite_serialize: #{e}"
|
||||
@ -105,7 +109,7 @@ No authorization required
|
||||
|
||||
|
||||
# **fake_outer_number_serialize**
|
||||
> OuterNumber fake_outer_number_serialize()
|
||||
> OuterNumber fake_outer_number_serialize(opts)
|
||||
|
||||
|
||||
|
||||
@ -117,10 +121,12 @@ Test serialization of outer number types
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::FakeApi.new
|
||||
|
||||
opts = {
|
||||
UNKNOWN_PARAM_NAME: Petstore::null.new # | Input number as post body
|
||||
}
|
||||
|
||||
begin
|
||||
result = api_instance.fake_outer_number_serialize()
|
||||
result = api_instance.fake_outer_number_serialize(opts)
|
||||
p result
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling FakeApi->fake_outer_number_serialize: #{e}"
|
||||
@ -149,7 +155,7 @@ No authorization required
|
||||
|
||||
|
||||
# **fake_outer_string_serialize**
|
||||
> OuterString fake_outer_string_serialize()
|
||||
> OuterString fake_outer_string_serialize(opts)
|
||||
|
||||
|
||||
|
||||
@ -161,10 +167,12 @@ Test serialization of outer string types
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::FakeApi.new
|
||||
|
||||
opts = {
|
||||
UNKNOWN_PARAM_NAME: Petstore::null.new # | Input string as post body
|
||||
}
|
||||
|
||||
begin
|
||||
result = api_instance.fake_outer_string_serialize()
|
||||
result = api_instance.fake_outer_string_serialize(opts)
|
||||
p result
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling FakeApi->fake_outer_string_serialize: #{e}"
|
||||
@ -203,12 +211,9 @@ No authorization required
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::FakeApi.new
|
||||
|
||||
query = 'query_example' # String |
|
||||
|
||||
user = Petstore::User.new # User |
|
||||
|
||||
|
||||
begin
|
||||
api_instance.test_body_with_query_params(query, user)
|
||||
rescue Petstore::ApiError => e
|
||||
@ -251,10 +256,8 @@ To test \"client\" model
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::FakeApi.new
|
||||
|
||||
client = Petstore::Client.new # Client | client model
|
||||
|
||||
|
||||
begin
|
||||
#To test \"client\" model
|
||||
result = api_instance.test_client_model(client)
|
||||
@ -304,10 +307,8 @@ Petstore.configure do |config|
|
||||
end
|
||||
|
||||
api_instance = Petstore::FakeApi.new
|
||||
|
||||
UNKNOWN_PARAM_NAME = Petstore::null.new # |
|
||||
|
||||
|
||||
begin
|
||||
#Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
api_instance.test_endpoint_parameters(UNKNOWN_PARAM_NAME)
|
||||
@ -338,7 +339,7 @@ nil (empty response body)
|
||||
|
||||
|
||||
# **test_enum_parameters**
|
||||
> test_enum_parameters()
|
||||
> test_enum_parameters(opts)
|
||||
|
||||
To test enum parameters
|
||||
|
||||
@ -350,11 +351,19 @@ To test enum parameters
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::FakeApi.new
|
||||
|
||||
opts = {
|
||||
enum_header_string_array: ['enum_header_string_array_example'], # Array<String> | Header parameter enum test (string array)
|
||||
enum_header_string: 'enum_header_string_example', # String | Header parameter enum test (string)
|
||||
enum_query_string_array: ['enum_query_string_array_example'], # Array<String> | Query parameter enum test (string array)
|
||||
enum_query_string: 'enum_query_string_example', # String | Query parameter enum test (string)
|
||||
enum_query_integer: 56, # Integer | Query parameter enum test (double)
|
||||
enum_query_double: 1.2, # Float | Query parameter enum test (double)
|
||||
UNKNOWN_PARAM_NAME: Petstore::null.new # |
|
||||
}
|
||||
|
||||
begin
|
||||
#To test enum parameters
|
||||
api_instance.test_enum_parameters()
|
||||
api_instance.test_enum_parameters(opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling FakeApi->test_enum_parameters: #{e}"
|
||||
end
|
||||
@ -398,10 +407,8 @@ test inline additionalProperties
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::FakeApi.new
|
||||
|
||||
UNKNOWN_PARAM_NAME = Petstore::null.new # | request body
|
||||
|
||||
|
||||
begin
|
||||
#test inline additionalProperties
|
||||
api_instance.test_inline_additional_properties(UNKNOWN_PARAM_NAME)
|
||||
@ -442,10 +449,8 @@ test json serialization of form data
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::FakeApi.new
|
||||
|
||||
UNKNOWN_PARAM_NAME = Petstore::null.new # |
|
||||
|
||||
|
||||
begin
|
||||
#test json serialization of form data
|
||||
api_instance.test_json_form_data(UNKNOWN_PARAM_NAME)
|
||||
|
@ -27,10 +27,8 @@ Petstore.configure do |config|
|
||||
end
|
||||
|
||||
api_instance = Petstore::FakeClassnameTags123Api.new
|
||||
|
||||
client = Petstore::Client.new # Client | client model
|
||||
|
||||
|
||||
begin
|
||||
#To test class name in snake case
|
||||
result = api_instance.test_classname(client)
|
||||
|
@ -30,10 +30,8 @@ Petstore.configure do |config|
|
||||
end
|
||||
|
||||
api_instance = Petstore::PetApi.new
|
||||
|
||||
pet = Petstore::Pet.new # Pet | Pet object that needs to be added to the store
|
||||
|
||||
|
||||
begin
|
||||
#Add a new pet to the store
|
||||
api_instance.add_pet(pet)
|
||||
@ -64,7 +62,7 @@ nil (empty response body)
|
||||
|
||||
|
||||
# **delete_pet**
|
||||
> delete_pet(pet_id)
|
||||
> delete_pet(pet_id, opts)
|
||||
|
||||
Deletes a pet
|
||||
|
||||
@ -79,13 +77,14 @@ Petstore.configure do |config|
|
||||
end
|
||||
|
||||
api_instance = Petstore::PetApi.new
|
||||
|
||||
pet_id = 789 # Integer | Pet id to delete
|
||||
|
||||
opts = {
|
||||
api_key: 'api_key_example' # String |
|
||||
}
|
||||
|
||||
begin
|
||||
#Deletes a pet
|
||||
api_instance.delete_pet(pet_id)
|
||||
api_instance.delete_pet(pet_id, opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling PetApi->delete_pet: #{e}"
|
||||
end
|
||||
@ -131,10 +130,8 @@ Petstore.configure do |config|
|
||||
end
|
||||
|
||||
api_instance = Petstore::PetApi.new
|
||||
|
||||
status = ['status_example'] # Array<String> | Status values that need to be considered for filter
|
||||
|
||||
|
||||
begin
|
||||
#Finds Pets by status
|
||||
result = api_instance.find_pets_by_status(status)
|
||||
@ -183,10 +180,8 @@ Petstore.configure do |config|
|
||||
end
|
||||
|
||||
api_instance = Petstore::PetApi.new
|
||||
|
||||
tags = ['tags_example'] # Array<String> | Tags to filter by
|
||||
|
||||
|
||||
begin
|
||||
#Finds Pets by tags
|
||||
result = api_instance.find_pets_by_tags(tags)
|
||||
@ -237,10 +232,8 @@ Petstore.configure do |config|
|
||||
end
|
||||
|
||||
api_instance = Petstore::PetApi.new
|
||||
|
||||
pet_id = 789 # Integer | ID of pet to return
|
||||
|
||||
|
||||
begin
|
||||
#Find pet by ID
|
||||
result = api_instance.get_pet_by_id(pet_id)
|
||||
@ -287,10 +280,8 @@ Petstore.configure do |config|
|
||||
end
|
||||
|
||||
api_instance = Petstore::PetApi.new
|
||||
|
||||
pet = Petstore::Pet.new # Pet | Pet object that needs to be added to the store
|
||||
|
||||
|
||||
begin
|
||||
#Update an existing pet
|
||||
api_instance.update_pet(pet)
|
||||
@ -321,7 +312,7 @@ nil (empty response body)
|
||||
|
||||
|
||||
# **update_pet_with_form**
|
||||
> update_pet_with_form(pet_id)
|
||||
> update_pet_with_form(pet_id, opts)
|
||||
|
||||
Updates a pet in the store with form data
|
||||
|
||||
@ -336,13 +327,15 @@ Petstore.configure do |config|
|
||||
end
|
||||
|
||||
api_instance = Petstore::PetApi.new
|
||||
|
||||
pet_id = 789 # Integer | ID of pet that needs to be updated
|
||||
|
||||
opts = {
|
||||
name: 'name_example', # String | Updated name of the pet
|
||||
status: 'status_example' # String | Updated status of the pet
|
||||
}
|
||||
|
||||
begin
|
||||
#Updates a pet in the store with form data
|
||||
api_instance.update_pet_with_form(pet_id)
|
||||
api_instance.update_pet_with_form(pet_id, opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling PetApi->update_pet_with_form: #{e}"
|
||||
end
|
||||
@ -372,7 +365,7 @@ nil (empty response body)
|
||||
|
||||
|
||||
# **upload_file**
|
||||
> ApiResponse upload_file(pet_id)
|
||||
> ApiResponse upload_file(pet_id, opts)
|
||||
|
||||
uploads an image
|
||||
|
||||
@ -387,13 +380,15 @@ Petstore.configure do |config|
|
||||
end
|
||||
|
||||
api_instance = Petstore::PetApi.new
|
||||
|
||||
pet_id = 789 # Integer | ID of pet to update
|
||||
|
||||
opts = {
|
||||
additional_metadata: 'additional_metadata_example', # String | Additional data to pass to server
|
||||
file: File.new('/path/to/file') # File | file to upload
|
||||
}
|
||||
|
||||
begin
|
||||
#uploads an image
|
||||
result = api_instance.upload_file(pet_id)
|
||||
result = api_instance.upload_file(pet_id, opts)
|
||||
p result
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling PetApi->upload_file: #{e}"
|
||||
|
@ -23,10 +23,8 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::StoreApi.new
|
||||
|
||||
order_id = 'order_id_example' # String | ID of the order that needs to be deleted
|
||||
|
||||
|
||||
begin
|
||||
#Delete purchase order by ID
|
||||
api_instance.delete_order(order_id)
|
||||
@ -117,10 +115,8 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::StoreApi.new
|
||||
|
||||
order_id = 789 # Integer | ID of pet that needs to be fetched
|
||||
|
||||
|
||||
begin
|
||||
#Find purchase order by ID
|
||||
result = api_instance.get_order_by_id(order_id)
|
||||
@ -162,10 +158,8 @@ Place an order for a pet
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::StoreApi.new
|
||||
|
||||
order = Petstore::Order.new # Order | order placed for purchasing the pet
|
||||
|
||||
|
||||
begin
|
||||
#Place an order for a pet
|
||||
result = api_instance.place_order(order)
|
||||
|
@ -27,10 +27,8 @@ This can only be done by the logged in user.
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::UserApi.new
|
||||
|
||||
user = Petstore::User.new # User | Created user object
|
||||
|
||||
|
||||
begin
|
||||
#Create user
|
||||
api_instance.create_user(user)
|
||||
@ -71,10 +69,8 @@ Creates list of users with given input array
|
||||
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
|
||||
api_instance.create_users_with_array_input(user)
|
||||
@ -115,10 +111,8 @@ Creates list of users with given input array
|
||||
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
|
||||
api_instance.create_users_with_list_input(user)
|
||||
@ -161,10 +155,8 @@ This can only be done by the logged in user.
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::UserApi.new
|
||||
|
||||
username = 'username_example' # String | The name that needs to be deleted
|
||||
|
||||
|
||||
begin
|
||||
#Delete user
|
||||
api_instance.delete_user(username)
|
||||
@ -205,10 +197,8 @@ Get user by user name
|
||||
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
|
||||
result = api_instance.get_user_by_name(username)
|
||||
@ -250,12 +240,9 @@ Logs user into the system
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::UserApi.new
|
||||
|
||||
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
|
||||
result = api_instance.login_user(username, password)
|
||||
@ -338,12 +325,9 @@ This can only be done by the logged in user.
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::UserApi.new
|
||||
|
||||
username = 'username_example' # String | name that need to be deleted
|
||||
|
||||
user = Petstore::User.new # User | Updated user object
|
||||
|
||||
|
||||
begin
|
||||
#Updated user
|
||||
api_instance.update_user(username, user)
|
||||
|
Loading…
x
Reference in New Issue
Block a user