2022-03-25 00:42:07 +08:00

5.2 KiB

UserApi

All URIs are relative to http://petstore.swagger.io:80/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

Creating UserApi

To initiate an instance of UserApi, you can use micronaut's ApplicationContext:

/* imports
import io.micronaut.runtime.Micronaut;
import io.micronaut.context.ApplicationContext;
import org.openapitools.api.UserApi;
*/

ApplicationContext context = Micronaut.run(/* ... */);
PetApi apiInstance = context.getBean(UserApi.class);

Or the @Inject annotation:

@Singleton
class MyClass {
    @Inject
    UserApi userApi;

    /* ... use the injected variable */
}

Note that the class needs to be annotated with one of Micronaut's scope annotations like Singleton in order to be processed.

More information can be found inside Inversion of Control guide section.

createUser

Mono<Void> UserApi.createUser(_body)

Create user

This can only be done by the logged in user.

Parameters

Name Type Description Notes
_body User Created user object

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

createUsersWithArrayInput

Mono<Void> UserApi.createUsersWithArrayInput(_body)

Creates list of users with given input array

Parameters

Name Type Description Notes
_body List<User> List of user object

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

createUsersWithListInput

Mono<Void> UserApi.createUsersWithListInput(_body)

Creates list of users with given input array

Parameters

Name Type Description Notes
_body List<User> List of user object

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

deleteUser

Mono<Void> UserApi.deleteUser(username)

Delete user

This can only be done by the logged in user.

Parameters

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

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

getUserByName

Mono<User> UserApi.getUserByName(username)

Get user by user name

Parameters

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

Return type

User

HTTP request headers

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

loginUser

Mono<String> UserApi.loginUser(usernamepassword)

Logs user into the system

Parameters

Name Type Description Notes
username String The user name for login
password String The password for login in clear text

Return type

String

HTTP request headers

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

logoutUser

Mono<Void> UserApi.logoutUser()

Logs out current logged in user session

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

updateUser

Mono<Void> UserApi.updateUser(username_body)

Updated user

This can only be done by the logged in user.

Parameters

Name Type Description Notes
username String name that need to be deleted
_body User Updated user object

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined