Mickael Magniez 38c33b92fe
Add scala-pekko client generator (#17417)
* feat: add scala-pekko client generator

* feat: add scala-pekko client to CI
2023-12-22 10:58:27 +08:00

20 KiB

UserApi

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

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

createUser

createUser(createUserRequest): ApiRequest[Unit]

Create user

This can only be done by the logged in user.

Example

// Import classes:
import 
import org.openapitools.client.core._
import org.openapitools.client.core.CollectionFormats._
import org.openapitools.client.core.ApiKeyLocations._

import org.apache.pekko.actor.ActorSystem
import scala.concurrent.Future
import scala.util.{Failure, Success}

object Example extends App {
    
    implicit val system: ActorSystem = ActorSystem()
    import system.dispatcher
    
    // Configure API key authorization: auth_cookie
    implicit val auth_cookie: ApiKeyValue = ApiKeyValue("YOUR API KEY")

    val apiInvoker = ApiInvoker()
    val apiInstance = UserApi("https://petstore.swagger.io/v2")
    val user: User =  // User | Created user object
    
    val request = apiInstance.createUser(user)
    val response = apiInvoker.execute(request)

    response.onComplete {
        case Success(ApiResponse(code, content, headers)) =>
            System.out.println(s"Status code: $code}")
            System.out.println(s"Response headers: ${headers.mkString(", ")}")
        
        case Failure(error @ ApiError(code, message, responseContent, cause, headers)) =>
            System.err.println("Exception when calling UserApi#createUser")
            System.err.println(s"Status code: $code}")
            System.err.println(s"Reason: $responseContent")
            System.err.println(s"Response headers: ${headers.mkString(", ")}")
            error.printStackTrace();

        case Failure(exception) => 
            System.err.println("Exception when calling UserApi#createUser")
            exception.printStackTrace();
    }
}

Parameters

Name Type Description Notes
user User Created user object

Return type

ApiRequest[Unit] (empty response body)

Authorization

auth_cookie

HTTP request headers

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

HTTP response details

Status code Description Response headers
0 successful operation -

createUsersWithArrayInput

createUsersWithArrayInput(createUsersWithArrayInputRequest): ApiRequest[Unit]

Creates list of users with given input array

Example

// Import classes:
import 
import org.openapitools.client.core._
import org.openapitools.client.core.CollectionFormats._
import org.openapitools.client.core.ApiKeyLocations._

import org.apache.pekko.actor.ActorSystem
import scala.concurrent.Future
import scala.util.{Failure, Success}

object Example extends App {
    
    implicit val system: ActorSystem = ActorSystem()
    import system.dispatcher
    
    // Configure API key authorization: auth_cookie
    implicit val auth_cookie: ApiKeyValue = ApiKeyValue("YOUR API KEY")

    val apiInvoker = ApiInvoker()
    val apiInstance = UserApi("https://petstore.swagger.io/v2")
    val user: Seq[User] =  // Seq[User] | List of user object
    
    val request = apiInstance.createUsersWithArrayInput(user)
    val response = apiInvoker.execute(request)

    response.onComplete {
        case Success(ApiResponse(code, content, headers)) =>
            System.out.println(s"Status code: $code}")
            System.out.println(s"Response headers: ${headers.mkString(", ")}")
        
        case Failure(error @ ApiError(code, message, responseContent, cause, headers)) =>
            System.err.println("Exception when calling UserApi#createUsersWithArrayInput")
            System.err.println(s"Status code: $code}")
            System.err.println(s"Reason: $responseContent")
            System.err.println(s"Response headers: ${headers.mkString(", ")}")
            error.printStackTrace();

        case Failure(exception) => 
            System.err.println("Exception when calling UserApi#createUsersWithArrayInput")
            exception.printStackTrace();
    }
}

Parameters

Name Type Description Notes
user Seq[User] List of user object

Return type

ApiRequest[Unit] (empty response body)

Authorization

auth_cookie

HTTP request headers

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

HTTP response details

Status code Description Response headers
0 successful operation -

createUsersWithListInput

createUsersWithListInput(createUsersWithListInputRequest): ApiRequest[Unit]

Creates list of users with given input array

Example

// Import classes:
import 
import org.openapitools.client.core._
import org.openapitools.client.core.CollectionFormats._
import org.openapitools.client.core.ApiKeyLocations._

import org.apache.pekko.actor.ActorSystem
import scala.concurrent.Future
import scala.util.{Failure, Success}

object Example extends App {
    
    implicit val system: ActorSystem = ActorSystem()
    import system.dispatcher
    
    // Configure API key authorization: auth_cookie
    implicit val auth_cookie: ApiKeyValue = ApiKeyValue("YOUR API KEY")

    val apiInvoker = ApiInvoker()
    val apiInstance = UserApi("https://petstore.swagger.io/v2")
    val user: Seq[User] =  // Seq[User] | List of user object
    
    val request = apiInstance.createUsersWithListInput(user)
    val response = apiInvoker.execute(request)

    response.onComplete {
        case Success(ApiResponse(code, content, headers)) =>
            System.out.println(s"Status code: $code}")
            System.out.println(s"Response headers: ${headers.mkString(", ")}")
        
        case Failure(error @ ApiError(code, message, responseContent, cause, headers)) =>
            System.err.println("Exception when calling UserApi#createUsersWithListInput")
            System.err.println(s"Status code: $code}")
            System.err.println(s"Reason: $responseContent")
            System.err.println(s"Response headers: ${headers.mkString(", ")}")
            error.printStackTrace();

        case Failure(exception) => 
            System.err.println("Exception when calling UserApi#createUsersWithListInput")
            exception.printStackTrace();
    }
}

Parameters

Name Type Description Notes
user Seq[User] List of user object

Return type

ApiRequest[Unit] (empty response body)

Authorization

auth_cookie

HTTP request headers

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

HTTP response details

Status code Description Response headers
0 successful operation -

deleteUser

deleteUser(deleteUserRequest): ApiRequest[Unit]

Delete user

This can only be done by the logged in user.

Example

// Import classes:
import org.openapitools.client.core._
import org.openapitools.client.core.CollectionFormats._
import org.openapitools.client.core.ApiKeyLocations._

import org.apache.pekko.actor.ActorSystem
import scala.concurrent.Future
import scala.util.{Failure, Success}

object Example extends App {
    
    implicit val system: ActorSystem = ActorSystem()
    import system.dispatcher
    
    // Configure API key authorization: auth_cookie
    implicit val auth_cookie: ApiKeyValue = ApiKeyValue("YOUR API KEY")

    val apiInvoker = ApiInvoker()
    val apiInstance = UserApi("https://petstore.swagger.io/v2")
    val username: String = username_example // String | The name that needs to be deleted
    
    val request = apiInstance.deleteUser(username)
    val response = apiInvoker.execute(request)

    response.onComplete {
        case Success(ApiResponse(code, content, headers)) =>
            System.out.println(s"Status code: $code}")
            System.out.println(s"Response headers: ${headers.mkString(", ")}")
        
        case Failure(error @ ApiError(code, message, responseContent, cause, headers)) =>
            System.err.println("Exception when calling UserApi#deleteUser")
            System.err.println(s"Status code: $code}")
            System.err.println(s"Reason: $responseContent")
            System.err.println(s"Response headers: ${headers.mkString(", ")}")
            error.printStackTrace();

        case Failure(exception) => 
            System.err.println("Exception when calling UserApi#deleteUser")
            exception.printStackTrace();
    }
}

Parameters

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

Return type

ApiRequest[Unit] (empty response body)

Authorization

auth_cookie

HTTP request headers

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

HTTP response details

Status code Description Response headers
400 Invalid username supplied -
404 User not found -

getUserByName

getUserByName(getUserByNameRequest): ApiRequest[User]

Get user by user name

Example

// Import classes:
import 
import org.openapitools.client.core._
import org.openapitools.client.core.CollectionFormats._
import org.openapitools.client.core.ApiKeyLocations._

import org.apache.pekko.actor.ActorSystem
import scala.concurrent.Future
import scala.util.{Failure, Success}

object Example extends App {
    
    implicit val system: ActorSystem = ActorSystem()
    import system.dispatcher

    val apiInvoker = ApiInvoker()
    val apiInstance = UserApi("https://petstore.swagger.io/v2")
    val username: String = username_example // String | The name that needs to be fetched. Use user1 for testing.
    
    val request = apiInstance.getUserByName(username)
    val response = apiInvoker.execute(request)

    response.onComplete {
        case Success(ApiResponse(code, content, headers)) =>
            System.out.println(s"Status code: $code}")
            System.out.println(s"Response headers: ${headers.mkString(", ")}")
            System.out.println(s"Response body: $content")
        
        case Failure(error @ ApiError(code, message, responseContent, cause, headers)) =>
            System.err.println("Exception when calling UserApi#getUserByName")
            System.err.println(s"Status code: $code}")
            System.err.println(s"Reason: $responseContent")
            System.err.println(s"Response headers: ${headers.mkString(", ")}")
            error.printStackTrace();

        case Failure(exception) => 
            System.err.println("Exception when calling UserApi#getUserByName")
            exception.printStackTrace();
    }
}

Parameters

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

Return type

ApiRequest[User]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 successful operation -
400 Invalid username supplied -
404 User not found -

loginUser

loginUser(loginUserRequest): ApiRequest[String]

Logs user into the system

Example

// Import classes:
import 
import org.openapitools.client.core._
import org.openapitools.client.core.CollectionFormats._
import org.openapitools.client.core.ApiKeyLocations._

import org.apache.pekko.actor.ActorSystem
import scala.concurrent.Future
import scala.util.{Failure, Success}

object Example extends App {
    
    implicit val system: ActorSystem = ActorSystem()
    import system.dispatcher

    val apiInvoker = ApiInvoker()
    val apiInstance = UserApi("https://petstore.swagger.io/v2")
    val username: String = username_example // String | The user name for login

    val password: String = password_example // String | The password for login in clear text
    
    val request = apiInstance.loginUser(username, password)
    val response = apiInvoker.execute(request)

    response.onComplete {
        case Success(ApiResponse(code, content, headers)) =>
            System.out.println(s"Status code: $code}")
            System.out.println(s"Response headers: ${headers.mkString(", ")}")
            System.out.println(s"Response body: $content")
        
        case Failure(error @ ApiError(code, message, responseContent, cause, headers)) =>
            System.err.println("Exception when calling UserApi#loginUser")
            System.err.println(s"Status code: $code}")
            System.err.println(s"Reason: $responseContent")
            System.err.println(s"Response headers: ${headers.mkString(", ")}")
            error.printStackTrace();

        case Failure(exception) => 
            System.err.println("Exception when calling UserApi#loginUser")
            exception.printStackTrace();
    }
}

Parameters

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

Return type

ApiRequest[String]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `auth_cookie` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
400 Invalid username/password supplied -

logoutUser

logoutUser(): ApiRequest[Unit]

Logs out current logged in user session

Example

// Import classes:
import org.openapitools.client.core._
import org.openapitools.client.core.CollectionFormats._
import org.openapitools.client.core.ApiKeyLocations._

import org.apache.pekko.actor.ActorSystem
import scala.concurrent.Future
import scala.util.{Failure, Success}

object Example extends App {
    
    implicit val system: ActorSystem = ActorSystem()
    import system.dispatcher
    
    // Configure API key authorization: auth_cookie
    implicit val auth_cookie: ApiKeyValue = ApiKeyValue("YOUR API KEY")

    val apiInvoker = ApiInvoker()
    val apiInstance = UserApi("https://petstore.swagger.io/v2")    
    val request = apiInstance.logoutUser()
    val response = apiInvoker.execute(request)

    response.onComplete {
        case Success(ApiResponse(code, content, headers)) =>
            System.out.println(s"Status code: $code}")
            System.out.println(s"Response headers: ${headers.mkString(", ")}")
        
        case Failure(error @ ApiError(code, message, responseContent, cause, headers)) =>
            System.err.println("Exception when calling UserApi#logoutUser")
            System.err.println(s"Status code: $code}")
            System.err.println(s"Reason: $responseContent")
            System.err.println(s"Response headers: ${headers.mkString(", ")}")
            error.printStackTrace();

        case Failure(exception) => 
            System.err.println("Exception when calling UserApi#logoutUser")
            exception.printStackTrace();
    }
}

Parameters

This endpoint does not need any parameter.

Return type

ApiRequest[Unit] (empty response body)

Authorization

auth_cookie

HTTP request headers

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

HTTP response details

Status code Description Response headers
0 successful operation -

updateUser

updateUser(updateUserRequest): ApiRequest[Unit]

Updated user

This can only be done by the logged in user.

Example

// Import classes:
import 
import org.openapitools.client.core._
import org.openapitools.client.core.CollectionFormats._
import org.openapitools.client.core.ApiKeyLocations._

import org.apache.pekko.actor.ActorSystem
import scala.concurrent.Future
import scala.util.{Failure, Success}

object Example extends App {
    
    implicit val system: ActorSystem = ActorSystem()
    import system.dispatcher
    
    // Configure API key authorization: auth_cookie
    implicit val auth_cookie: ApiKeyValue = ApiKeyValue("YOUR API KEY")

    val apiInvoker = ApiInvoker()
    val apiInstance = UserApi("https://petstore.swagger.io/v2")
    val username: String = username_example // String | name that need to be deleted

    val user: User =  // User | Updated user object
    
    val request = apiInstance.updateUser(username, user)
    val response = apiInvoker.execute(request)

    response.onComplete {
        case Success(ApiResponse(code, content, headers)) =>
            System.out.println(s"Status code: $code}")
            System.out.println(s"Response headers: ${headers.mkString(", ")}")
        
        case Failure(error @ ApiError(code, message, responseContent, cause, headers)) =>
            System.err.println("Exception when calling UserApi#updateUser")
            System.err.println(s"Status code: $code}")
            System.err.println(s"Reason: $responseContent")
            System.err.println(s"Response headers: ${headers.mkString(", ")}")
            error.printStackTrace();

        case Failure(exception) => 
            System.err.println("Exception when calling UserApi#updateUser")
            exception.printStackTrace();
    }
}

Parameters

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

Return type

ApiRequest[Unit] (empty response body)

Authorization

auth_cookie

HTTP request headers

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

HTTP response details

Status code Description Response headers
400 Invalid user supplied -
404 User not found -