remove scala oas3 samples (#6446)

This commit is contained in:
William Cheng 2020-05-28 21:42:10 +08:00 committed by GitHub
parent b87c927fc2
commit 34ccec889a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 0 additions and 1073 deletions

View File

@ -1,23 +0,0 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@ -1,17 +0,0 @@
README.md
build.sbt
src/main/scala/org/openapitools/client/api/EnumsSerializers.scala
src/main/scala/org/openapitools/client/api/PetApi.scala
src/main/scala/org/openapitools/client/api/StoreApi.scala
src/main/scala/org/openapitools/client/api/UserApi.scala
src/main/scala/org/openapitools/client/core/ApiInvoker.scala
src/main/scala/org/openapitools/client/core/Serializers.scala
src/main/scala/org/openapitools/client/core/requests.scala
src/main/scala/org/openapitools/client/model/ApiResponse.scala
src/main/scala/org/openapitools/client/model/Category.scala
src/main/scala/org/openapitools/client/model/InlineObject.scala
src/main/scala/org/openapitools/client/model/InlineObject1.scala
src/main/scala/org/openapitools/client/model/Order.scala
src/main/scala/org/openapitools/client/model/Pet.scala
src/main/scala/org/openapitools/client/model/Tag.scala
src/main/scala/org/openapitools/client/model/User.scala

View File

@ -1,115 +0,0 @@
# 'scala-sttp-petstore'
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-sttp-petstore'</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-sttp-petstore':1.0.0"
```
### SBT users
```scala
libraryDependencies += "org.openapitools" % "'scala-sttp-petstore'" % "1.0.0"
```
## Getting Started
## Documentation for API Endpoints
All URIs are relative to *http://petstore.swagger.io/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*PetApi* | **addPet** | **POST** /pet | Add a new pet to the store
*PetApi* | **deletePet** | **DELETE** /pet/${petId} | Deletes a pet
*PetApi* | **findPetsByStatus** | **GET** /pet/findByStatus | Finds Pets by status
*PetApi* | **findPetsByTags** | **GET** /pet/findByTags | Finds Pets by tags
*PetApi* | **getPetById** | **GET** /pet/${petId} | Find pet by ID
*PetApi* | **updatePet** | **PUT** /pet | Update an existing pet
*PetApi* | **updatePetWithForm** | **POST** /pet/${petId} | Updates a pet in the store with form data
*PetApi* | **uploadFile** | **POST** /pet/${petId}/uploadImage | uploads an image
*StoreApi* | **deleteOrder** | **DELETE** /store/order/${orderId} | Delete purchase order by ID
*StoreApi* | **getInventory** | **GET** /store/inventory | Returns pet inventories by status
*StoreApi* | **getOrderById** | **GET** /store/order/${orderId} | Find purchase order by ID
*StoreApi* | **placeOrder** | **POST** /store/order | Place an order for a pet
*UserApi* | **createUser** | **POST** /user | Create user
*UserApi* | **createUsersWithArrayInput** | **POST** /user/createWithArray | Creates list of users with given input array
*UserApi* | **createUsersWithListInput** | **POST** /user/createWithList | Creates list of users with given input array
*UserApi* | **deleteUser** | **DELETE** /user/${username} | Delete user
*UserApi* | **getUserByName** | **GET** /user/${username} | Get user by user name
*UserApi* | **loginUser** | **GET** /user/login | Logs user into the system
*UserApi* | **logoutUser** | **GET** /user/logout | Logs out current logged in user session
*UserApi* | **updateUser** | **PUT** /user/${username} | Updated user
## Documentation for Models
- [ApiResponse](ApiResponse.md)
- [Category](Category.md)
- [InlineObject](InlineObject.md)
- [InlineObject1](InlineObject1.md)
- [Order](Order.md)
- [Pet](Pet.md)
- [Tag](Tag.md)
- [User](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
## Author

View File

@ -1,24 +0,0 @@
version := "1.0.0"
name := "&#39;scala-sttp-petstore&#39;"
organization := "org.openapitools"
scalaVersion := "2.13.0"
crossScalaVersions := Seq(scalaVersion.value, "2.12.10", "2.11.12")
libraryDependencies ++= Seq(
"com.softwaremill.sttp.client" %% "core" % "2.0.0",
"com.softwaremill.sttp.client" %% "json4s" % "2.0.0",
"org.json4s" %% "json4s-jackson" % "3.6.7",
// test dependencies
"org.scalatest" %% "scalatest" % "3.0.8" % Test,
"junit" % "junit" % "4.13" % "test"
)
scalacOptions := Seq(
"-unchecked",
"-deprecation",
"-feature"
)
publishArtifact in (Compile, packageDoc) := false

View File

@ -1,32 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>scalaz-sttp-petstore-client</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>scala-sttp-petstore-client</name>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<id>sbt-test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sbt</executable>
<arguments>
<argument>test</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,51 +0,0 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.api
import org.openapitools.client.model._
import org.json4s._
import scala.reflect.ClassTag
object EnumsSerializers {
def all: Seq[Serializer[_]] = Seq[Serializer[_]]() :+
new EnumNameSerializer(OrderEnums.Status) :+
new EnumNameSerializer(PetEnums.Status)
private class EnumNameSerializer[E <: Enumeration: ClassTag](enum: E)
extends Serializer[E#Value] {
import JsonDSL._
val EnumerationClass: Class[E#Value] = classOf[E#Value]
def deserialize(implicit format: Formats):
PartialFunction[(TypeInfo, JValue), E#Value] = {
case (t @ TypeInfo(EnumerationClass, _), json) if isValid(json) =>
json match {
case JString(value) =>
enum.withName(value)
case value =>
throw new MappingException(s"Can't convert $value to $EnumerationClass")
}
}
private[this] def isValid(json: JValue) = json match {
case JString(value) if enum.values.exists(_.toString == value) => true
case _ => false
}
def serialize(implicit format: Formats): PartialFunction[Any, JValue] = {
case i: E#Value => i.toString
}
}
}

View File

@ -1,163 +0,0 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.api
import org.openapitools.client.model.ApiResponse
import java.io.File
import org.openapitools.client.model.Pet
import org.openapitools.client.core._
import alias._
import sttp.client._
import sttp.model.Method
object PetApi {
def apply(baseUrl: String = "http://petstore.swagger.io/v2")(implicit serializer: SttpSerializer) = new PetApi(baseUrl)
}
class PetApi(baseUrl: String)(implicit serializer: SttpSerializer) {
import Helpers._
import serializer._
/**
* Expected answers:
* code 200 : Pet (successful operation)
* code 405 : (Invalid input)
*
* @param pet Pet object that needs to be added to the store
*/
def addPet(pet: Pet): ApiRequestT[Pet] =
basicRequest
.method(Method.POST, uri"$baseUrl/pet")
.contentType("application/json")
.body(pet)
.response(asJson[Pet])
/**
* Expected answers:
* code 400 : (Invalid pet value)
*
* @param petId Pet id to delete
* @param apiKey
*/
def deletePet(petId: Long, apiKey: Option[String] = None): ApiRequestT[Unit] =
basicRequest
.method(Method.DELETE, uri"$baseUrl/pet/${petId}")
.contentType("application/json")
.header("api_key", apiKey)
.response(asJson[Unit])
/**
* Multiple status values can be provided with comma separated strings
*
* Expected answers:
* code 200 : Seq[Pet] (successful operation)
* code 400 : (Invalid status value)
*
* @param status Status values that need to be considered for filter
*/
def findPetsByStatus(status: Seq[String]): ApiRequestT[Seq[Pet]] =
basicRequest
.method(Method.GET, uri"$baseUrl/pet/findByStatus?status=$status")
.contentType("application/json")
.response(asJson[Seq[Pet]])
/**
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
*
* Expected answers:
* code 200 : Seq[Pet] (successful operation)
* code 400 : (Invalid tag value)
*
* @param tags Tags to filter by
*/
def findPetsByTags(tags: Seq[String]): ApiRequestT[Seq[Pet]] =
basicRequest
.method(Method.GET, uri"$baseUrl/pet/findByTags?tags=$tags")
.contentType("application/json")
.response(asJson[Seq[Pet]])
/**
* Returns a single pet
*
* Expected answers:
* code 200 : Pet (successful operation)
* code 400 : (Invalid ID supplied)
* code 404 : (Pet not found)
*
* Available security schemes:
* api_key (apiKey)
*
* @param petId ID of pet to return
*/
def getPetById(petId: Long)(implicit apiKey: ApiKeyValue): ApiRequestT[Pet] =
basicRequest
.method(Method.GET, uri"$baseUrl/pet/${petId}")
.contentType("application/json")
.header("api_key", apiKey.value)
.response(asJson[Pet])
/**
* Expected answers:
* code 200 : Pet (successful operation)
* code 400 : (Invalid ID supplied)
* code 404 : (Pet not found)
* code 405 : (Validation exception)
*
* @param pet Pet object that needs to be added to the store
*/
def updatePet(pet: Pet): ApiRequestT[Pet] =
basicRequest
.method(Method.PUT, uri"$baseUrl/pet")
.contentType("application/json")
.body(pet)
.response(asJson[Pet])
/**
* Expected answers:
* code 405 : (Invalid input)
*
* @param petId ID of pet that needs to be updated
* @param name Updated name of the pet
* @param status Updated status of the pet
*/
def updatePetWithForm(petId: Long, name: Option[String] = None, status: Option[String] = None): ApiRequestT[Unit] =
basicRequest
.method(Method.POST, uri"$baseUrl/pet/${petId}")
.contentType("application/x-www-form-urlencoded")
.body(Map(
"name" -> name,
"status" -> status,
))
.response(asJson[Unit])
/**
* Expected answers:
* code 200 : ApiResponse (successful operation)
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server
* @param file file to upload
*/
def uploadFile(petId: Long, additionalMetadata: Option[String] = None, file: Option[File] = None): ApiRequestT[ApiResponse] =
basicRequest
.method(Method.POST, uri"$baseUrl/pet/${petId}/uploadImage")
.contentType("multipart/form-data")
.body(Map(
"additionalMetadata" -> additionalMetadata,
"file" -> file,
))
.response(asJson[ApiResponse])
}

View File

@ -1,92 +0,0 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.api
import org.openapitools.client.model.Order
import org.openapitools.client.core._
import alias._
import sttp.client._
import sttp.model.Method
object StoreApi {
def apply(baseUrl: String = "http://petstore.swagger.io/v2")(implicit serializer: SttpSerializer) = new StoreApi(baseUrl)
}
class StoreApi(baseUrl: String)(implicit serializer: SttpSerializer) {
import Helpers._
import serializer._
/**
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
*
* Expected answers:
* code 400 : (Invalid ID supplied)
* code 404 : (Order not found)
*
* @param orderId ID of the order that needs to be deleted
*/
def deleteOrder(orderId: String): ApiRequestT[Unit] =
basicRequest
.method(Method.DELETE, uri"$baseUrl/store/order/${orderId}")
.contentType("application/json")
.response(asJson[Unit])
/**
* Returns a map of status codes to quantities
*
* Expected answers:
* code 200 : Map[String, Int] (successful operation)
*
* Available security schemes:
* api_key (apiKey)
*/
def getInventory()(implicit apiKey: ApiKeyValue): ApiRequestT[Map[String, Int]] =
basicRequest
.method(Method.GET, uri"$baseUrl/store/inventory")
.contentType("application/json")
.header("api_key", apiKey.value)
.response(asJson[Map[String, Int]])
/**
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
*
* Expected answers:
* code 200 : Order (successful operation)
* code 400 : (Invalid ID supplied)
* code 404 : (Order not found)
*
* @param orderId ID of pet that needs to be fetched
*/
def getOrderById(orderId: Long): ApiRequestT[Order] =
basicRequest
.method(Method.GET, uri"$baseUrl/store/order/${orderId}")
.contentType("application/json")
.response(asJson[Order])
/**
* Expected answers:
* code 200 : Order (successful operation)
* code 400 : (Invalid Order)
*
* @param order order placed for purchasing the pet
*/
def placeOrder(order: Order): ApiRequestT[Order] =
basicRequest
.method(Method.POST, uri"$baseUrl/store/order")
.contentType("application/json")
.body(order)
.response(asJson[Order])
}

View File

@ -1,170 +0,0 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.api
import org.openapitools.client.model.User
import org.openapitools.client.core._
import alias._
import sttp.client._
import sttp.model.Method
object UserApi {
def apply(baseUrl: String = "http://petstore.swagger.io/v2")(implicit serializer: SttpSerializer) = new UserApi(baseUrl)
}
class UserApi(baseUrl: String)(implicit serializer: SttpSerializer) {
import Helpers._
import serializer._
/**
* This can only be done by the logged in user.
*
* Expected answers:
* code 0 : (successful operation)
*
* Available security schemes:
* api_key (apiKey)
*
* @param user Created user object
*/
def createUser(user: User)(implicit apiKey: ApiKeyValue): ApiRequestT[Unit] =
basicRequest
.method(Method.POST, uri"$baseUrl/user")
.contentType("application/json")
.header("api_key", apiKey.value)
.body(user)
.response(asJson[Unit])
/**
* Expected answers:
* code 0 : (successful operation)
*
* Available security schemes:
* api_key (apiKey)
*
* @param user List of user object
*/
def createUsersWithArrayInput(user: Seq[User])(implicit apiKey: ApiKeyValue): ApiRequestT[Unit] =
basicRequest
.method(Method.POST, uri"$baseUrl/user/createWithArray")
.contentType("application/json")
.header("api_key", apiKey.value)
.body(user)
.response(asJson[Unit])
/**
* Expected answers:
* code 0 : (successful operation)
*
* Available security schemes:
* api_key (apiKey)
*
* @param user List of user object
*/
def createUsersWithListInput(user: Seq[User])(implicit apiKey: ApiKeyValue): ApiRequestT[Unit] =
basicRequest
.method(Method.POST, uri"$baseUrl/user/createWithList")
.contentType("application/json")
.header("api_key", apiKey.value)
.body(user)
.response(asJson[Unit])
/**
* This can only be done by the logged in user.
*
* Expected answers:
* code 400 : (Invalid username supplied)
* code 404 : (User not found)
*
* Available security schemes:
* api_key (apiKey)
*
* @param username The name that needs to be deleted
*/
def deleteUser(username: String)(implicit apiKey: ApiKeyValue): ApiRequestT[Unit] =
basicRequest
.method(Method.DELETE, uri"$baseUrl/user/${username}")
.contentType("application/json")
.header("api_key", apiKey.value)
.response(asJson[Unit])
/**
* Expected answers:
* code 200 : User (successful operation)
* code 400 : (Invalid username supplied)
* code 404 : (User not found)
*
* @param username The name that needs to be fetched. Use user1 for testing.
*/
def getUserByName(username: String): ApiRequestT[User] =
basicRequest
.method(Method.GET, uri"$baseUrl/user/${username}")
.contentType("application/json")
.response(asJson[User])
/**
* Expected answers:
* code 200 : String (successful operation)
* Headers :
* Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when toekn expires
* code 400 : (Invalid username/password supplied)
*
* @param username The user name for login
* @param password The password for login in clear text
*/
def loginUser(username: String, password: String): ApiRequestT[String] =
basicRequest
.method(Method.GET, uri"$baseUrl/user/login?username=$username&password=$password")
.contentType("application/json")
.response(asJson[String])
/**
* Expected answers:
* code 0 : (successful operation)
*
* Available security schemes:
* api_key (apiKey)
*/
def logoutUser()(implicit apiKey: ApiKeyValue): ApiRequestT[Unit] =
basicRequest
.method(Method.GET, uri"$baseUrl/user/logout")
.contentType("application/json")
.header("api_key", apiKey.value)
.response(asJson[Unit])
/**
* This can only be done by the logged in user.
*
* Expected answers:
* code 400 : (Invalid user supplied)
* code 404 : (User not found)
*
* Available security schemes:
* api_key (apiKey)
*
* @param username name that need to be deleted
* @param user Updated user object
*/
def updateUser(username: String, user: User)(implicit apiKey: ApiKeyValue): ApiRequestT[Unit] =
basicRequest
.method(Method.PUT, uri"$baseUrl/user/${username}")
.contentType("application/json")
.header("api_key", apiKey.value)
.body(user)
.response(asJson[Unit])
}

View File

@ -1,60 +0,0 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.core
import org.json4s._
import sttp.client._
import sttp.model.StatusCode
import org.openapitools.client.api.EnumsSerializers
import sttp.client.json4s.SttpJson4sApi
import sttp.client.monad.MonadError
class SttpSerializer(implicit val format: Formats = DefaultFormats ++ EnumsSerializers.all ++ Serializers.all,
implicit val serialization: org.json4s.Serialization = org.json4s.jackson.Serialization) extends SttpJson4sApi
class HttpException(val statusCode: StatusCode, val statusText: String, val message: String) extends Exception(s"[$statusCode] $statusText: $message")
object Helpers {
// Helper to handle Optional header parameters
implicit class optionalParams(val request: RequestT[Identity, Either[String, String], Nothing]) extends AnyVal {
def header( header: String, optValue: Option[Any]): RequestT[Identity, Either[String, String], Nothing] = {
optValue.map( value => request.header(header, value.toString)).getOrElse(request)
}
}
}
object ApiInvoker {
/**
* Allows request execution without calling apiInvoker.execute(request)
* request.result can be used to get a monad wrapped content.
*
* @param request the apiRequest to be executed
*/
implicit class ApiRequestImprovements[R[_], T](request: RequestT[Identity, Either[ResponseError[Exception], T], Nothing]) {
def result(implicit backend: SttpBackend[R, Nothing, Nothing]): R[T] = {
val responseT = request.send()
val ME: MonadError[R] = backend.responseMonad
ME.flatMap(responseT) {
response =>
response.body match {
case Left(ex) => ME.error[T](new HttpException(response.code, response.statusText, ex.body))
case Right(value) => ME.unit(value)
}
}
}
}
}

View File

@ -1,31 +0,0 @@
package org.openapitools.client.core
import java.time.{LocalDate, LocalDateTime, OffsetDateTime, ZoneId}
import java.time.format.DateTimeFormatter
import scala.util.Try
import org.json4s.{Serializer, CustomSerializer, JNull}
import org.json4s.JsonAST.JString
object Serializers {
case object DateTimeSerializer extends CustomSerializer[OffsetDateTime](_ => ( {
case JString(s) =>
Try(OffsetDateTime.parse(s, DateTimeFormatter.ISO_OFFSET_DATE_TIME)) orElse
Try(LocalDateTime.parse(s).atZone(ZoneId.systemDefault()).toOffsetDateTime) getOrElse (null)
case JNull => null
}, {
case d: OffsetDateTime =>
JString(d.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME))
}))
case object LocalDateSerializer extends CustomSerializer[LocalDate]( _ => ( {
case JString(s) => LocalDate.parse(s)
case JNull => null
}, {
case d: LocalDate =>
JString(d.format(DateTimeFormatter.ISO_LOCAL_DATE))
}))
def all: Seq[Serializer[_]] = Seq[Serializer[_]]() :+ LocalDateSerializer :+ DateTimeSerializer
}

View File

@ -1,58 +0,0 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.core
import sttp.client.{Identity, RequestT, ResponseError}
/**
* This trait needs to be added to any model defined by the api.
*/
trait ApiModel
/**
* Sttp type aliases
*/
object alias {
type ApiRequestT[T] = RequestT[Identity, Either[ResponseError[Exception], T], Nothing]
}
/**
* Single trait defining a credential that can be transformed to a paramName / paramValue tupple
*/
sealed trait Credentials {
def asQueryParam: Option[(String, String)] = None
}
sealed case class BasicCredentials(user: String, password: String) extends Credentials
sealed case class BearerToken(token: String) extends Credentials
sealed case class ApiKeyCredentials(key: ApiKeyValue, keyName: String, location: ApiKeyLocation) extends Credentials {
override def asQueryParam: Option[(String, String)] = location match {
case ApiKeyLocations.QUERY => Some((keyName, key.value))
case _ => None
}
}
sealed case class ApiKeyValue(value: String)
sealed trait ApiKeyLocation
object ApiKeyLocations {
case object QUERY extends ApiKeyLocation
case object HEADER extends ApiKeyLocation
case object COOKIE extends ApiKeyLocation
}

View File

@ -1,26 +0,0 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model
import org.openapitools.client.core.ApiModel
/**
* An uploaded response
* Describes the result of uploading an image resource
*/
case class ApiResponse(
code: Option[Int] = None,
`type`: Option[String] = None,
message: Option[String] = None
) extends ApiModel

View File

@ -1,25 +0,0 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model
import org.openapitools.client.core.ApiModel
/**
* Pet category
* A category for a pet
*/
case class Category(
id: Option[Long] = None,
name: Option[String] = None
) extends ApiModel

View File

@ -1,23 +0,0 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model
import org.openapitools.client.core.ApiModel
case class InlineObject(
/* Updated name of the pet */
name: Option[String] = None,
/* Updated status of the pet */
status: Option[String] = None
) extends ApiModel

View File

@ -1,24 +0,0 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model
import java.io.File
import org.openapitools.client.core.ApiModel
case class InlineObject1(
/* Additional data to pass to server */
additionalMetadata: Option[String] = None,
/* file to upload */
file: Option[File] = None
) extends ApiModel

View File

@ -1,41 +0,0 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model
import java.time.OffsetDateTime
import org.openapitools.client.core.ApiModel
/**
* Pet Order
* An order for a pets from the pet store
*/
case class Order(
id: Option[Long] = None,
petId: Option[Long] = None,
quantity: Option[Int] = None,
shipDate: Option[OffsetDateTime] = None,
/* Order Status */
status: Option[OrderEnums.Status] = None,
complete: Option[Boolean] = None
) extends ApiModel
object OrderEnums {
type Status = Status.Value
object Status extends Enumeration {
val Placed = Value("placed")
val Approved = Value("approved")
val Delivered = Value("delivered")
}
}

View File

@ -1,40 +0,0 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model
import org.openapitools.client.core.ApiModel
/**
* a Pet
* A pet for sale in the pet store
*/
case class Pet(
id: Option[Long] = None,
category: Option[Category] = None,
name: String,
photoUrls: Seq[String],
tags: Option[Seq[Tag]] = None,
/* pet status in the store */
status: Option[PetEnums.Status] = None
) extends ApiModel
object PetEnums {
type Status = Status.Value
object Status extends Enumeration {
val Available = Value("available")
val Pending = Value("pending")
val Sold = Value("sold")
}
}

View File

@ -1,25 +0,0 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model
import org.openapitools.client.core.ApiModel
/**
* Pet Tag
* A tag for a pet
*/
case class Tag(
id: Option[Long] = None,
name: Option[String] = None
) extends ApiModel

View File

@ -1,32 +0,0 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model
import org.openapitools.client.core.ApiModel
/**
* a User
* A User who is purchasing from the pet store
*/
case class User(
id: Option[Long] = None,
username: Option[String] = None,
firstName: Option[String] = None,
lastName: Option[String] = None,
email: Option[String] = None,
password: Option[String] = None,
phone: Option[String] = None,
/* User Status */
userStatus: Option[Int] = None
) extends ApiModel