forked from loafle/openapi-generator-original
167 lines
5.7 KiB
Markdown
167 lines
5.7 KiB
Markdown
# scala-akka-petstore-client
|
|
|
|
OpenAPI Petstore
|
|
- API version: 1.0.0
|
|
|
|
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
|
|
|
|
|
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
|
|
|
|
## Requirements
|
|
|
|
Building the API client library requires:
|
|
1. Java 1.7+
|
|
2. Maven/Gradle/SBT
|
|
|
|
## Installation
|
|
|
|
To install the API client library to your local Maven repository, simply execute:
|
|
|
|
```shell
|
|
mvn clean install
|
|
```
|
|
|
|
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
|
|
|
|
```shell
|
|
mvn clean deploy
|
|
```
|
|
|
|
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
|
|
|
|
### Maven users
|
|
|
|
Add this dependency to your project's POM:
|
|
|
|
```xml
|
|
<dependency>
|
|
<groupId>org.openapitools</groupId>
|
|
<artifactId>scala-akka-petstore-client</artifactId>
|
|
<version>1.0.0</version>
|
|
<scope>compile</scope>
|
|
</dependency>
|
|
```
|
|
|
|
### Gradle users
|
|
|
|
Add this dependency to your project's build file:
|
|
|
|
```groovy
|
|
compile "org.openapitools:scala-akka-petstore-client:1.0.0"
|
|
```
|
|
|
|
### SBT users
|
|
|
|
```scala
|
|
libraryDependencies += "org.openapitools" % "scala-akka-petstore-client" % "1.0.0"
|
|
```
|
|
|
|
## Getting Started
|
|
|
|
Please follow the [installation](#installation) instruction and execute the following Java code:
|
|
|
|
```scala
|
|
|
|
import org.openapitools.client.core._
|
|
import org.openapitools.client.model._
|
|
import org.openapitools.client.api.PetApi
|
|
|
|
import akka.actor.ActorSystem
|
|
import scala.concurrent.Future
|
|
import scala.util.{Failure, Success}
|
|
|
|
object PetApiExample extends App {
|
|
|
|
implicit val system: ActorSystem = ActorSystem()
|
|
import system.dispatcher
|
|
|
|
// Create invoker to execute requests
|
|
val apiInvoker = ApiInvoker()
|
|
val apiInstance = PetApi("http://petstore.swagger.io/v2")
|
|
val pet: Pet = // Pet | Pet object that needs to be added to the store
|
|
|
|
val request = apiInstance.addPet(pet)
|
|
val response = apiInvoker.execute(request)
|
|
|
|
response.onComplete {
|
|
case Success(org.openapitools.client.core.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 PetApi#addPet")
|
|
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 PetApi#addPet")
|
|
exception.printStackTrace();
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
## Documentation for API Endpoints
|
|
|
|
All URIs are relative to *http://petstore.swagger.io/v2*
|
|
|
|
Class | Method | HTTP request | Description
|
|
------------ | ------------- | ------------- | -------------
|
|
*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
|
*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
|
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
|
*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
|
|
*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
|
|
*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
|
*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
|
*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
|
*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
|
*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
|
*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
|
*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
|
*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user
|
|
*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
|
|
*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
|
|
*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user
|
|
*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name
|
|
*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system
|
|
*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session
|
|
*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user
|
|
|
|
|
|
## Documentation for Models
|
|
|
|
- [ApiResponse](docs/ApiResponse.md)
|
|
- [Category](docs/Category.md)
|
|
- [Order](docs/Order.md)
|
|
- [Pet](docs/Pet.md)
|
|
- [Tag](docs/Tag.md)
|
|
- [User](docs/User.md)
|
|
|
|
|
|
## Documentation for Authorization
|
|
|
|
Authentication schemes defined for the API:
|
|
### api_key
|
|
|
|
- **Type**: API key
|
|
- **API key parameter name**: api_key
|
|
- **Location**: HTTP header
|
|
|
|
### auth_cookie
|
|
|
|
- **Type**: API key
|
|
- **API key parameter name**: AUTH_KEY
|
|
- **Location**:
|
|
|
|
|
|
## Author
|
|
|
|
|
|
|